lkml.org 
[lkml]   [2011]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [slubllv7 06/17] slub: Add cmpxchg_double_slab()
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".





\
 
 \ /
  Last update: 2011-07-12 18:01    [W:0.147 / U:7.308 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site