Re: [PATCH] lib: Check for migrate_disable only on SMP systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Scott,

On Fri, Dec 06, 2019 at 12:49:12PM -0600, Scott Wood wrote:
> On Fri, 2019-12-06 at 15:21 +0100, Daniel Wagner wrote:
> > In case the kernel configuration is UP is, the migrate_disable member
> > in task_struct is missing.
> > 
> > linux/lib/smp_processor_id.c: In function ‘check_preemption_disabled’:
> > linux/lib/smp_processor_id.c:26:13: error: ‘struct task_struct’ has no
> > member named ‘migrate_disable’
> >     26 |  if (current->migrate_disable)
> >        |             ^~
> > 
> > Fixes: 425c5b38779a ("sched: Lazy migrate_disable processing")
> > Cc: Scott Wood <swood@xxxxxxxxxx>
> > Cc: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> > Signed-off-by: Daniel Wagner <dwagner@xxxxxxx>
> > ---
> >  lib/smp_processor_id.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c
> > index 5f2618d346c4..a914f73e3652 100644
> > --- a/lib/smp_processor_id.c
> > +++ b/lib/smp_processor_id.c
> > @@ -23,8 +23,10 @@ unsigned int check_preemption_disabled(const char
> > *what1, const char *what2)
> >  	 * Kernel threads bound to a single CPU can safely use
> >  	 * smp_processor_id():
> >  	 */
> > +#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE)
> >  	if (current->migrate_disable)
> >  		goto out;
> > +#endif
> 
> Won't this give false positives on UP with CONFIG_PREEMPT_RT_BASE and
> CONFIG_DEBUG_PREEMPT? If we have CONFIG_SCHED_DEBUG then we can still check
> migrate_disable.

Ohhh, I see what you mean. I didn't realize that migrate_disable is
also available with CONFIG_SCHED_DEBUG. So the ifdef should be
something like:

#if defined(CONFIG_PREEMP_RT_BASE) && \
    (defined(CONFIG_SMP) || \
      (!defined(CONFIG_SMP) && defined(CONFIG_SCHED_DEBUG)))

?

Hmm, looks a bit ugly but I haven't found a simplification. Long time
since I did logic algebra...

Thanks,
Daniel



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux