Messages in this thread | | | Date | Mon, 29 Nov 2010 10:11:38 -0600 (CST) | From | Christoph Lameter <> | Subject | Re: [thisops uV2 09/10] x86: this_cpu_cmpxchg and this_cpu_cmpxchg_double operations |
| |
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.
| |