[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a1MFgRxm6=+9WZKNzN+Nc5fhrDso6orSNQaaa-0yqygYA@mail.gmail.com>
Date: Wed, 27 May 2020 13:26:51 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Marco Elver <elver@...gle.com>
Cc: Will Deacon <will@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
"Paul E. McKenney" <paulmck@...nel.org>,
Dmitry Vyukov <dvyukov@...gle.com>,
Alexander Potapenko <glider@...gle.com>,
Andrey Konovalov <andreyknvl@...gle.com>,
kasan-dev <kasan-dev@...glegroups.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Stephen Rothwell <sfr@...b.auug.org.au>
Subject: Re: [PATCH -tip] compiler_types.h: Optimize __unqual_scalar_typeof
compilation time
On Wed, May 27, 2020 at 12:33 PM Marco Elver <elver@...gle.com> wrote:
>
> If the compiler supports C11's _Generic, use it to speed up compilation
> times of __unqual_scalar_typeof(). GCC version 4.9 or later and
> all supported versions of Clang support the feature (the oldest
> supported compiler that doesn't support _Generic is GCC 4.8, for which
> we use the slower alternative).
>
> The non-_Generic variant relies on multiple expansions of
> __pick_integer_type -> __pick_scalar_type -> __builtin_choose_expr,
> which increases pre-processed code size, and can cause compile times to
> increase in files with numerous expansions of READ_ONCE(), or other
> users of __unqual_scalar_typeof().
>
> Summary of compile-time benchmarking done by Arnd Bergmann [1]:
>
> <baseline normalized time> clang-11 gcc-9
> this patch 0.78 0.91
> ideal 0.76 0.86
>
> [1] https://lkml.kernel.org/r/CAK8P3a3UYQeXhiufUevz=rwe09WM_vSTCd9W+KvJHJcOeQyWVA@mail.gmail.com
>
> Further compile-testing done with:
> gcc 4.8, 4.9, 5.5, 6.4, 7.5, 8.4;
> clang 9, 10.
>
> Reported-by: Arnd Bergmann <arnd@...db.de>
> Signed-off-by: Marco Elver <elver@...gle.com>
This gives us back 80% of the performance drop on clang, and 50%
of the drop I saw with gcc, compared to current mainline.
Tested-by: Arnd Bergmann <arnd@...db.de>
Powered by blists - more mailing lists