From: Alexey Dobriyan <adobriyan@gmail.com>
To: Marco Elver <elver@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH] compiler.h: simplify data_race() macro
Date: Mon, 24 Jun 2024 17:37:54 +0300 [thread overview]
Message-ID: <c46bf4ac-91e8-4594-966b-b46fbdc140ce@p183> (raw)
In-Reply-To: <CANpmjNO=zv6D807cNLAQ3eGLrigUs9xtYNxoHhyuYvHkhhSUWg@mail.gmail.com>
On Mon, Jun 24, 2024 at 02:27:43PM +0200, Marco Elver wrote:
> On Mon, 24 Jun 2024 at 13:49, Alexey Dobriyan <adobriyan@gmail.com> wrote:
> >
> > Use auto type deduction and comma expression to decrease macro expansion
> > size.
> >
> > __unqual_scalar_typeof() is quite wordy macro by itself.
> >
> > "expr" can be arbitrary complex so not expanding it twice is good.
> > Should be faster too because type is deduced only once
> > from the initializer.
> >
> > Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
>
> Thanks for cleaning up. That code certainly predates the availability
> of __auto_type. Although if I recall correctly, __unqual_scalar_typeof
> became the first user of _Generic (the first C11 keyword we used in
> the kernel?), but we used some ifdef to still support ancient
> compilers initially (that definitely also didn't have __auto_type).
>
> Reviewed-by: Marco Elver <elver@google.com>
>
> Which tree is this for?
This is against mainline. Should not really matter, -next has the same code.
> > --- a/include/linux/compiler.h
> > +++ b/include/linux/compiler.h
> > @@ -200,10 +200,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
> > */
> > #define data_race(expr) \
> > ({ \
> > - __unqual_scalar_typeof(({ expr; })) __v = ({ \
> > - __kcsan_disable_current(); \
> > - expr; \
> > - }); \
> > + __auto_type __v = (__kcsan_disable_current(), expr); \
> > __kcsan_enable_current(); \
> > __v; \
> > })
next prev parent reply other threads:[~2024-06-24 14:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-24 11:49 Alexey Dobriyan
2024-06-24 12:27 ` Marco Elver
2024-06-24 14:37 ` Alexey Dobriyan [this message]
2024-06-24 14:41 ` Marco Elver
2024-06-24 14:42 ` Alexey Dobriyan
2024-06-24 15:09 ` Marco Elver
2024-06-24 15:39 ` [PATCH v2] " Alexey Dobriyan
2024-06-24 15:41 ` Marco Elver
2024-06-28 15:03 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c46bf4ac-91e8-4594-966b-b46fbdc140ce@p183 \
--to=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=elver@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®