[PATCH 3/3] child_wait_callback: check __WNOTHREAD case

From: Oleg Nesterov
Date: Thu Jul 02 2009 - 13:29:26 EST


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.

Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
---

kernel/exit.c | 3 +++
1 file changed, 3 insertions(+)

--- WAIT/kernel/exit.c~3_WNOTHREAD 2009-07-02 18:38:03.000000000 +0200
+++ WAIT/kernel/exit.c 2009-07-02 18:44:43.000000000 +0200
@@ -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);
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/