Re: [RFC PATCH] kernel: sched: Provide a pointer to the valid CPU mask
From: Peter Zijlstra
Date: Thu Apr 06 2017 - 07:41:43 EST
On Thu, Apr 06, 2017 at 12:58:27PM +0200, Thomas Gleixner wrote:
> On Thu, 6 Apr 2017, Peter Zijlstra wrote:
> > Because mainline will not get anything other than prempt_disable() for
> > migrate_disable().
>
> I'm not yet convinced of that. There is enough stuff which pointlessly
> disables preemption and works around the restrictions caused by that or
> plays games with cpus_allowed just to stay on a particular cpu.
>
> I know you don't like it because it imposes restrictions on schedulability,
> but disabling preemption for a long time or playing cpus_allowed games has
> the same and worse effects.
There really isn't much code that plays games with cpus_allowed. And
code that disabled preemption for a long time can surely be fixed, we've
done so many a time.
A pure migrate_disable() (without wrapping lock) is a straight up
nightmare, you can end up with a gazillion runnable tasks stuck to one
CPU and all other CPUs with their thumbs up their arses waiting for
work.
The moment you stick migrate_disable() in a lock, you at least get PI to
bail you out of some of the pain (but by no means all of it).
Adding migrate_disable() to the kernel is really just moving pain
around, it doesn't solve anything much.