Re: [PATCH 1/1] sched/core: Fix migrate_swap() vs. hotplug

From: Kuyo Chang
Date: Fri Jun 13 2025 - 03:53:52 EST


On Fri, 2025-06-06 at 10:28 +0200, Peter Zijlstra wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> On Fri, Jun 06, 2025 at 11:46:57AM +0800, Kuyo Chang wrote:
>
> > Thank you for your patch.
> > I believe this patch also effectively addresses this race
> > condition.
> > I will queue it in our test pool for testing.
>
> Thank you; I shall await the results!
>
It works well during both regular and hotplug tests(one week).
I believe the patch is workable.
Please help to merge, thx.

>
> > > @@ -101,12 +98,12 @@ static bool cpu_stop_queue_work(unsigned int
> > > cpu, struct cpu_stop_work *work)
> > >         raw_spin_lock_irqsave(&stopper->lock, flags);
> > >         enabled = stopper->enabled;
> > >         if (enabled)
> > > -               __cpu_stop_queue_work(stopper, work, &wakeq);
> > > +               __cpu_stop_queue_work(stopper, work);
> > >         else if (work->done)
> > >                 cpu_stop_signal_done(work->done);
> > >         raw_spin_unlock_irqrestore(&stopper->lock, flags);
> > >
> > > -       wake_up_q(&wakeq);
> > > +       wake_up_process(stopper->thread);
> >
> > BTW, should we add enabled check here?
> >       if (enabled)
> >               wake_up_process(stopper->thread);
>
> Ah yes. Spuriously waking the stopper thread is harmless, but
> wasteful.
>
> > >         preempt_enable();
> > >
> > >         return enabled;