Skip to contentSkip to conversation

Optimize the cpu hotplug locking -v2

PATCH George Spelvin 2 participants 3 messages Oct 11, 2013

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines

There's places in the kernel that does for_each_cpu() that I'm sure you don't want to disable preemption for. Especially when you start having 4096 CPU machines!

Er... why not?

Seriously. If I have 4096 processors, and preemption is disabled on *one* of them for a long time, can't an urgent task just find a different processor to preempt?

This seems like a non-problem. Or am I misunderstanding something about processor affinity?

#1 lore raw
Quoted 9 lines · On 11 Oct 2013 08:14:57 -0400 "George Spelvin" <[email protected]> wrote:
Quoted 3 lines

There's places in the kernel that does for_each_cpu() that I'm sure you don't want to disable preemption for. Especially when you start having 4096 CPU machines!

Er... why not?

Seriously. If I have 4096 processors, and preemption is disabled on *one* of them for a long time, can't an urgent task just find a different processor to preempt?

The problem is that the scheduler doesn't see that the current task has preemption disabled. It only looks at the priorities of the current task, and if it can preempt it, it will. It sets the NEED_RESCHED to the current task and waits for the preemption to schedule it out.

If an RT task is woken on a CPU that's running a SCHED_OTHER task that's doing this loop. It will have to wait for the loop to finish before it can schedule in. After doing the wake up, the scheduling algorithm is happy that it got an RT task on a CPU quickly, when in reality it has to wait a long time till preemption is enabled again.

-- Steve

Quoted 3 lines

This seems like a non-problem. Or am I misunderstanding something about processor affinity?

#2 lore raw
Quoted 4 lines

The problem is that the scheduler doesn't see that the current task has preemption disabled. It only looks at the priorities of the current task, and if it can preempt it, it will. It sets the NEED_RESCHED to the current task and waits for the preemption to schedule it out.

Ah, got it. It's a priority inversion problem, and while there is a standard solution (priority inheritance), if I were to suggest such a heavyweight solution, Linus would start yelling again and Sarah would get unhappy, and we all know how that ends up.

Thank you. I will now cease displaying my ignorance in public.