do_wait() wakeup optimization: child_wait_callback: check __WNOTHREAD case
authorOleg Nesterov <oleg@redhat.com>
Wed, 23 Sep 2009 22:56:47 +0000 (15:56 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Sep 2009 14:21:00 +0000 (07:21 -0700)
commitb4fe51823d797d6959b2eee7868023e61606daa9
treee078feaa1cdfbbdc98b5f5f668fecc37c1907b2e
parent0b7570e77f7c3abd43107dabc47ea89daf9a1cba
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>
kernel/exit.c