[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1102251444330.7359@router.home>
Date: Fri, 25 Feb 2011 14:46:54 -0600 (CST)
From: Christoph Lameter <cl@...ux.com>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
cc: Tejun Heo <tj@...nel.org>, akpm@...ux-foundation.org,
Pekka Enberg <penberg@...helsinki.fi>,
linux-kernel@...r.kernel.org,
Eric Dumazet <eric.dumazet@...il.com>,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [cpuops cmpxchg double V3 4/5] Lockless (and preemptless)
fastpaths for slub
On Fri, 25 Feb 2011, Mathieu Desnoyers wrote:
> > Index: linux-2.6/include/linux/slub_def.h
> > ===================================================================
> > --- linux-2.6.orig/include/linux/slub_def.h 2011-02-25 10:45:49.000000000 -0600
> > +++ linux-2.6/include/linux/slub_def.h 2011-02-25 10:46:19.000000000 -0600
> > @@ -35,7 +35,10 @@ enum stat_item {
> > NR_SLUB_STAT_ITEMS };
> >
> > struct kmem_cache_cpu {
> > - void **freelist; /* Pointer to first free per cpu object */
> > + void **freelist; /* Pointer to next available object */
> > +#ifdef CONFIG_CMPXCHG_LOCAL
> > + unsigned long tid; /* Globally unique transaction id */
> > +#endif
>
> There seem to be no strong guarantee that freelist is double-word aligned here.
The struct kmem_cache_cpu allocation via alloc_percpu() specifies double
word alignment. See the remainder of the code quoted by you:
> > +#ifdef CONFIG_CMPXCHG_LOCAL
> > + /*
> > + * Must align to double word boundary for the double cmpxchg instructions
> > + * to work.
> > + */
> > + s->cpu_slab = __alloc_percpu(sizeof(struct kmem_cache_cpu), 2 * sizeof(void *));
> > +#else
> > + /* Regular alignment is sufficient */
> > s->cpu_slab = alloc_percpu(struct kmem_cache_cpu);
> > +#endif
> > +
> > + if (!s->cpu_slab)
> > + return 0;
> >
> > - return s->cpu_slab != NULL;
> > + init_kmem_cache_cpus(s);
> > +
> > + return 1;
> > }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists