Re: [PATCH] locking/atomics: don't alias ____ptr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 28 Jun 2017, Dmitry Vyukov wrote:
> On Wed, Jun 28, 2017 at 2:24 PM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> > On Wed, 28 Jun 2017, Dmitry Vyukov wrote:
> >> On Wed, Jun 28, 2017 at 1:10 PM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> >> >  #define cmpxchg_local(ptr, old, new)                   \
> >> >  ({                                                     \
> >> > -       __typeof__(ptr) ____ptr = (ptr);                \
> >> > -       kasan_check_write(____ptr, sizeof(*____ptr));   \
> >> > -       arch_cmpxchg_local(____ptr, (old), (new));      \
> >> > +       kasan_check_write((ptr), sizeof(*(ptr)));       \
> >> > +       arch_cmpxchg_local((ptr), (old), (new));        \
> >>
> >>
> >> /\/\/\/\/\/\/\/\/\/\/\/\
> >>
> >> These are macros.
> >> If ptr is foo(), then we will call foo() twice.
> >
> > If that's true, the foo() will be evaluated a gazillion more times down the
> > way to the end of this macro maze.
> 
> No. If we do:
> 
> __typeof__(ptr) ____ptr = (ptr);
> 
> and then only use ____ptr, then ptr is evaluated only once regardless
> of what the rest of macros do.

What I meant is, that we have today nested macros which do a lot of that
same nonsense even w/o that patch.

Thanks,

	tglx

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux