Re: [RFC PATCH 09/16] sched/fair: core wide cfs task priority comparison(Internet mail)
From: Jiang Biao
Date: Fri Jul 24 2020 - 08:09:06 EST
On Fri, 24 Jul 2020 at 15:17, Aaron Lu <aaron.lwe@xxxxxxxxx> wrote:
> On Wed, Jul 22, 2020 at 12:23:44AM +0000, benbjiang(èå) wrote:
> > > +/*
> > > + * This function takes care of adjusting the min_vruntime of siblings of
> > > + * a core during coresched enable/disable.
> > > + * This is called in stop machine context so no need to take the rq lock.
> > Hi,
> > IMHO, it seems that stop machine context cannot guarantee race free. The param *cpu* maybe not *this_cpu*, rq lock should be taken even in stop machine context, and irq should be disabled too, to avoid potential races with other contexts.
> In stop machine context, all CPUs except the active ones are spinning
> with irq disabled and in this invocation of stop_machine(), only one
> CPU is active so I don't think race is possible.
You're right, stop_machine provides much more protection than stop_*_cpu.
Thanks for the explanation.