Skip to contentSkip to conversation

child_wait_callback: check __WNOTHREAD case

PATCH In review Oleg Nesterov 1 participant 1 message Jul 2, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 child_wait_callback: check __WNOTHREAD case

Suggested by Roland.

do_wait(__WNOTHREAD) can only succeed if the caller is either ptracer, or it is ->real_parent and the child is not traced. IOW, caller == p->parent otherwise we should not wake up.

Change child_wait_callback() to check this. Ratan reports the workload with CPU load >99% caused by unnecessary wakeups, should be fixed by this patch.

---

 kernel/exit.c |    3 +++
 1 file changed, 3 insertions(+)
kernel/exit.c renamed from kernel/exit.c~3_WNOTHREAD +3 -0
@@ -1569,6 +1569,9 @@ static int child_wait_callback(wait_queu
 	if (!eligible_child(wo, p))
 		return 0;
 
+	if ((wo->wo_flags & __WNOTHREAD) && wait->private != p->parent)
+		return 0;
+
 	return default_wake_function(wait, mode, sync, key);
 }