diff options
author | Oleg Nesterov <oleg@redhat.com> | 2009-09-24 00:56:47 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-24 16:21:00 +0200 |
commit | b4fe51823d797d6959b2eee7868023e61606daa9 (patch) | |
tree | e078feaa1cdfbbdc98b5f5f668fecc37c1907b2e /kernel/exit.c | |
parent | do_wait() wakeup optimization: change __wake_up_parent() to use filtered wakeup (diff) | |
download | linux-b4fe51823d797d6959b2eee7868023e61606daa9.tar.xz linux-b4fe51823d797d6959b2eee7868023e61606daa9.zip |
do_wait() wakeup optimization: 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.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Roland McGrath <roland@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ratan Nalumasu <rnalumasu@gmail.com>
Cc: Vitaly Mayatskikh <vmayatsk@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 7838b4d68774..270a68b7f22f 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1581,6 +1581,9 @@ static int child_wait_callback(wait_queue_t *wait, unsigned mode, 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); } |