Skip to contentSkip to conversation

do_wait() wakeup optimization

RFC PATCH In review Oleg Nesterov 1 participant 3 messages Jun 22, 2009 – Jun 24, 2009 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

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]

#2 lore raw
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]

#4 lore raw
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_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);
 }