Re: [thisops uV2 09/10] x86: this_cpu_cmpxchg and this_cpu_cmpxchg_doubleoperations

From: Christoph Lameter
Date: Mon Nov 29 2010 - 11:11:47 EST


On Sat, 27 Nov 2010, Mathieu Desnoyers wrote:

> > + */
> > +#define percpu_cmpxchg16b(pcp, o1, o2, n1, n2) \
> > +({ \
> > + char __ret; \
> > + typeof(o1) __o1 = o1; \
> > + typeof(o1) __n1 = n1; \
> > + typeof(o2) __o2 = o2; \
> > + typeof(o2) __n2 = n2; \
> > + typeof(o2) __dummy; \
> > + VM_BUG_ON(((unsigned long)pcp) % 16); \
>
> Restricting typing on "pcp" at build time might be more appropriate. E.g.
> creating a "struct doublecas" that would be forcefully aligned on 16 bytes. We
> could check that with __builtin_types_compatible_p and generate a build failure
> if necessary.

That would in turn restrict the types which can be used with
cmpxchg_double. The existing slub implementation already uses a mixture of
pointer and unsigned long. And there are 32 bit and 64 bit variants
already.

--
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/