Messages in this thread | | | Date | Tue, 20 Nov 2007 16:23:28 -0500 | From | Mathieu Desnoyers <> | Subject | Re: [rfc 04/45] cpu alloc: Use in SLUB |
| |
* Christoph Lameter (clameter@sgi.com) wrote:
> > The cpu_read acts as a safeguard checking that we do not change CPU > > between the read and the cmpxchg. If we are preempted between the "c" > > read and the cpu_read, we could do a !cpu_node_match(c, node) check that > > would apply to the wrong cpu. > > C is not pointing to a specific cpu. It can only be used in CPU_xx ops to > address the currrent cpu. > > > > @@ -1800,19 +1792,19 @@ static void __always_inline slab_free(st > > > * then any change of cpu_slab will cause the cmpxchg to fail > > > * since the freelist pointers are unique per slab. > > > */ > > > - if (unlikely(page != c->page || c->node < 0)) { > > > - __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 ?
-- 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |