do_wait() wakeup optimization
cover do_wait() wakeup optimization
Now that we have struct wait_opts, it is easy to solve the problems with unnecessary wakeups from __wake_up_parent(). See the previous discussion
"+ do_wait-wakeup-optimization.patch added to -mm tree" http://marc.info/?t=122729873300001
However, this complicates the code a bit and adds bytes 112 to compiled code.
Ratan, Roland, do you think this optimisation is worthwhile?
Oleg.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines · Ratan Nalumasu
Yes, it is something we really need. The specific case I have (hundreds of NTPL threads in a program, and each thread managing a child process), the CPU load is >99% with NTPL threads, near 0% with the patch
^^^^^^^^^
Thanks. Did you test this patch, or do you mean the previous one?
Quoted 1 line
So, yes, the complication is worthwhile.
I am asking because I am not sure this change is enough, note the "We can make child_wait_callback() more clever later" in the changelog.
__wake_up_parent() passes key = p, but we can pass more info and do additional checks in child_wait_callback().
Oleg.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · Ratan Nalumasu
Quoted 6 lines · Oleg Nesterov
Quoted 2 lines · Ratan Nalumasu
Yes, it is something we really need. The specific case I have (hundreds
of
Quoted 2 lines
NTPL threads in a program, and each thread managing a child process), the CPU load is >99% with NTPL threads, near 0% with the patch
Quoted 7 lines
Quoted 4 lines
^^^^^^^^^Thanks. Did you test this patch, or do you mean the previous one?
Sorry, I meant the previous patch. I realize that there are more steps to take before we get to a complete solution.
I think Roland has already showed us the necessary step.
I'd like to think a bit more before sending this patch, but any chance you can test these 2 patches + "3/2" below?
Oleg.
kernel/exit.c renamed from kernel/exit.c~ +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); }