On Mon, Aug 22, 2016 at 11:48:53AM -0700, Eric Dumazet wrote:
> On Mon, Aug 22, 2016 at 10:34 AM, Paul E. McKenney
> <[email protected]> wrote:
> 
> > That does have much to say for itself, though I would prefer sizeof(void
> > *) to sizeof(unsigned long).  But would it make sense to define a mask
> > on a per-architecture basis, with the default being (sizeof(void *) - 1)?
> > Then maybe an IMPROPERLY_ALIGNED_POINTER():
> >
> >         #ifndef CONFIG_ARCH_POINTER_ALIGNMENT
> >         #define CONFIG_ARCH_POINTER_ALIGNMENT (sizeof(void *) - 1)
> >         #endif
> >
> >         #define IMPROPERLY_ALIGNED_POINTER(p) \
> >                 ((p) & CONFIG_ARCH_POINTER_ALIGNMENT)
> >
> > m68k would define ARCH_POINTER_ALIGNMENT to 1, and all other arches
> > would leave it undefined.
> >
> > Then __call_rcu() could to this:
> >
> >         WARN_ON_ONCE(IMPROPERLY_ALIGNED_POINTER(head));
> 
> Don't we have __alignof__(void *) to avoid #ifdef CONFIG_M68K and
> other new macros ?

Yes, but that 'hides' the m68k funny, while doing an explicit #ifdef has
documentation value... but I don't care too deeply.

Reply via email to