Re: [rfc 04/45] cpu alloc: Use in SLUB

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

 



* Christoph Lameter ([email protected]) wrote:
> On Tue, 20 Nov 2007, Mathieu Desnoyers wrote:
> 
> > > > > -			__slab_free(s, page, x, addr, c->offset);
> > > > > +		if (unlikely(page != __CPU_READ(c->page) ||
> > > > > +					__CPU_READ(c->node) < 0)) {
> > > > > +			__slab_free(s, page, x, addr, __CPU_READ(c->offset));
> > > > 
> > > > And same question as above : what happens if we fail after executing the
> > > > __slab_free.. is it valid to do it twice ?
> > > 
> > > __slab_free is always successful and will never cause a repeat of the 
> > > loop.
> > 
> > Then what happens if we are migrated between the end of __slab_free and
> > the CPU_CMPXCHG ? The cmpxchg would fail, and the __slab_free will be
> > done twice ?
> 
> Look at the control flow. The __slab_free can never be done twice.
> 
> {
>                 freelist = __CPU_READ(c->freelist);
>                 barrier();
>                 if (unlikely(page != __CPU_READ(c->page) ||
>                                         __CPU_READ(c->node) < 0)) {
>                         __slab_free(s, page, x, addr);
>                         break;
> 			^^^^^^^ no redo of the loop possible.
> 
>                 }
>                 set_freepointer(s, object, freelist);
>         } while (CPU_CMPXCHG(c->freelist, freelist, object) != freelist);
> 

oops, I should remember not to review code before my first coffee in the
morning ;)

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux