public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] child_wait_callback: check __WNOTHREAD case
@ 2009-07-02 17:25 Oleg Nesterov
  0 siblings, 0 replies; only message in thread
From: Oleg Nesterov @ 2009-07-02 17:25 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Ingo Molnar, Ratan Nalumasu, Roland McGrath, Vitaly Mayatskikh,
	linux-kernel

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@redhat.com>
---

 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);
 }
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-07-02 17:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-02 17:25 [PATCH 3/3] child_wait_callback: check __WNOTHREAD case Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox