Re: [PATCH] hotplug: Optimize {get,put}_online_cpus()

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

 



On 10/01, Paul E. McKenney wrote:
>
> On Sun, Sep 29, 2013 at 03:56:46PM +0200, Oleg Nesterov wrote:
> > On 09/27, Oleg Nesterov wrote:
> > >
> > > I tried hard to find any hole in this version but failed, I believe it
> > > is correct.
> >
> > And I still believe it is. But now I am starting to think that we
> > don't need cpuhp_seq. (and imo cpuhp_waitcount, but this is minor).
>
> Here is one scenario that I believe requires cpuhp_seq:
>
> 1.	Task 0 on CPU 0 increments its counter on entry.
>
> 2.	Task 1 on CPU 1 starts summing the counters and gets to
> 	CPU 4.  The sum thus far is 1 (Task 0).
>
> 3.	Task 2 on CPU 2 increments its counter on entry.
> 	Upon completing its entry code, it re-enables preemption.

afaics at this stage it should notice state = BLOCK and decrement
the same counter on the same CPU before it does preempt_enable().

Because:

> > 	2. It is the reader which tries to take this lock and
> > 	   noticed state == BLOCK. We could miss the result of
> > 	   its inc(), but we do not care, this reader is going
> > 	   to block.
> >
> > 	   _If_ the reader could migrate between inc/dec, then
> > 	   yes, we have a problem. Because that dec() could make
> > 	   the result of per_cpu_sum() = 0. IOW, we could miss
> > 	   inc() but notice dec(). But given that it does this
> > 	   on the same CPU this is not possible.
> >
> > So why do we need cpuhp_seq?
>
> Good question, I will look again.

Thanks! much appreciated.

Oleg.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]