Re: [PATCH v3] sched/rt: Do not account migrate-disabled tasks as pushable

From: Peter Zijlstra

Date: Thu Nov 19 2026 - 10:18:10 EST


On Thu, Nov 19, 2026 at 04:08:12PM +0100, Peter Zijlstra wrote:
> On Thu, Nov 19, 2026 at 12:06:21PM +0000, Mel Gorman wrote:
>
> > > > > Suppose:
> > > > >
> > > > > migrate_disable();
> > > > > ...
> > > > > schedule()
> > > > > migrate_disable_switch()
> > > > > // switches p->cpus_ptr and p->nr_cpus_allowed
> > > > > pick_next_task()
> > > > > p = class->pick_task();
> > > > > put_prev_set_next_task(rq, rq->donor, p);
> > > > > return p;
> > > > >
> > > > > So any task that ends up in put_prev_task_rt() wlll have passed through
> > > > > migrate_disable_switch(), which have updated nr_cpus_allowed.
> > > > >
> >
> > Short summary, this assumption is wrong, nr_cpus_allowed is not updated
> > in that path.

> Bah, and I cannot remember either. Let me have a poke, see if something
> bubbles up.

So this version did update nr_cpus_allowed:

https://patch.msgid.link/20200921163845.769861942%40infradead.org

And the next version it did not:

https://patch.msgid.link/20201005150921.859981475%40infradead.org

But I can't seem to locate quite yet why it changed.