lkml.org 
[lkml]   [2018]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: for_each_cpu() is buggy for UP kernel?
Date
> From: Linus Torvalds <torvalds@linux-foundation.org>
> Sent: Tuesday, May 15, 2018 10:22
> To: Dexuan Cui <decui@microsoft.com>
>
> On Mon, May 14, 2018 at 8:02 PM Dexuan Cui <decui@microsoft.com> wrote:
>
> > If you're OK with the below fix (not tested yet), I'll submit a patch for it:
>
> > --- a/kernel/time/tick-broadcast.c
> > +++ b/kernel/time/tick-broadcast.c
> > @@ -616,6 +616,10 @@ static void tick_handle_oneshot_broadcast(struct
> clock_event_device *dev)
> > now = ktime_get();
> > /* Find all expired events */
> > for_each_cpu(cpu, tick_broadcast_oneshot_mask) {
> > +#ifndef CONFIG_SMP
> > + if (cpumask_empty(tick_broadcast_oneshot_mask))
> > + break;
> > +#endif
>
> I'm certainly ok with this. It's hacky, but maybe being explicitly hacky is
> good to "document" this gotcha.
>
> And I really do agree that this special UP case is nasty nasty and much too
> subtle, and I hope that some day we won't care about UP at all, and maybe
> kill it, or maybe just make for_each_cpu() generate the extra code to have
> the actual same semantics as the SMP case.
>
> Linus

Thanks! I submitted the patch just now: https://lkml.org/lkml/2018/5/15/866

Thanks,
-- Dexuan
\
 
 \ /
  Last update: 2018-05-15 22:11    [W:0.030 / U:5.744 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site