Re: [PATCH v3] sched: Reset cpumask if __migrate_task() failed for migration_cpu_stop()
From: Karl Mehltretter
Date: Wed Dec 02 2026 - 20:50:51 EST
On Wed, Dec 02, 2026 at 03:42:40PM +0100, Peter Zijlstra wrote:
> > > if (task_rq(p) == rq && task_on_rq_queued(p))
> > > - rq = __migrate_task(rq, &rf, p, cpu);
> > > + rq = move_queued_task(rq, &rf, p, cpu);
> > [...]
> > > - struct rq *dest_rq = __migrate_task(rq, &rf, p, cpu);
> > > + struct rq *dest_rq = move_queued_task(rq, &rf, p, cpu);
> >
> > Don't you still need the is_cpu_allowed() check here? Both push stoppers
> > do select_fallback_rq() before taking rq->lock.
>
> All hold p->pi_lock, and hence IRQs and preemption are disabled, the
> affinity mask it locked and hotplug will wait for an RCU grace period
> due to deactivate_cpu or somesuch.
>
yes, that makes sense for affinity and hotplug.
I'm still wondering about migrate_disable().
Unlike try_to_wake_up(), the push stoppers call select_fallback_rq()
before taking rq->lock. If p is running on another CPU with migration
disabled at that point, is_cpu_allowed() only checks cpu_online().
Could p then re-enable migration and move back to rq before
rq_lock() in sched_non_preferred_cpu_push_stop()?
Thanks,
Karl