child_wait_callback: check __WNOTHREAD case
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.
Signed-off-by Oleg Nesterov <[email protected]>
---
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_queuif (!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); }