Re: [slubllv7 06/17] slub: Add cmpxchg_double_slab()

From: Christoph Lameter
Date: Tue Jul 12 2011 - 11:59:45 EST


On Mon, 11 Jul 2011, Eric Dumazet wrote:

> > @@ -338,6 +342,37 @@ static inline int oo_objects(struct kmem
> > return x.x & OO_MASK;
> > }
> >
> > +static inline bool cmpxchg_double_slab(struct kmem_cache *s, struct page *page,
> > + void *freelist_old, unsigned long counters_old,
> > + void *freelist_new, unsigned long counters_new,
> > + const char *n)
> > +{
> > +#ifdef CONFIG_CMPXCHG_DOUBLE
> > + if (s->flags & __CMPXCHG_DOUBLE) {
> > + if (cmpxchg_double(&page->freelist,
> > + freelist_old, counters_old,
> > + freelist_new, counters_new))
> > + return 1;
> > + } else
> > +#endif
> > + {
> > + if (page->freelist == freelist_old && page->counters == counters_old) {
> > + page->freelist = freelist_new;
> > + page->counters = counters_new;
> > + return 1;
> > + }
> > + }
>
> This works only on 64bit arches, where page->counters get all following
> fields combined : inuse, objects, frozen, _count
>
> On 32bit arch, I am afraid you have to disable the cmpxchg_double()
> thing ?

We do not need to have _count included. This is just there because the
field is in the way on 64 bit and we can only do 2x 64 bit cmpxchges. On
32 bi we can drop _count from "counters".



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/