Re: [PATCH -tip] compiler_types.h: Optimize __unqual_scalar_typeof compilation time

From: Sedat Dilek
Date: Wed May 27 2020 - 09:12:06 EST


On Wed, May 27, 2020 at 2:50 PM Arnd Bergmann <arnd@xxxxxxxx> wrote:
>
> On Wed, May 27, 2020 at 2:35 PM Sedat Dilek <sedat.dilek@xxxxxxxxx> wrote:
> > On Wed, May 27, 2020 at 2:31 PM Arnd Bergmann <arnd@xxxxxxxx> wrote:
> > > On Wed, May 27, 2020 at 1:36 PM Sedat Dilek <sedat.dilek@xxxxxxxxx> wrote:
> > > > On Wed, May 27, 2020 at 1:27 PM Arnd Bergmann <arnd@xxxxxxxx> wrote:
> > > > > On Wed, May 27, 2020 at 12:33 PM Marco Elver <elver@xxxxxxxxxx> wrote:
> > > > >
> > > > > 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@xxxxxxxx>
> > > > >
> > > >
> > > > Hi Arnd,
> > > >
> > > > with "mainline" you mean Linux-next aka Linux v5.8 - not v5.7?
> > >
> > > I meant v5.7.
> > >
> > > > I have not seen __unqual_scalar_typeof(x) in compiler_types.h in Linux v5.7.
> > > >
> > > > Is there a speedup benefit also for Linux v5.7?
> > > > Which patches do I need?
> > >
> > > v5.7-rc is the baseline and is the fastest I currently see. On certain files,
> > > I saw an intermittent 10x slowdown that was already fixed earlier, now
> > > linux-next
> > > is more like 2x slowdown for me and 1.2x with this patch on top, so we're
> > > almost back to the speed of linux-5.7.
> > >
> >
> > Which clang version did you use - and have you set KCSAN kconfigs -
> > AFAICS this needs clang-11?
>
> I'm currently using clang-11, but I see the same problem with older
> versions, and both with and without KCSAN enabled. I think the issue
> is mostly the deep nesting of macros that leads to code bloat.
>

Thanks.

With clang-10:

$ scripts/diffconfig /boot/config-5.7.0-rc7-2-amd64-clang .config
BUILD_SALT "5.7.0-rc7-2-amd64-clang" -> "5.7.0-rc7-3-amd64-clang"
+HAVE_ARCH_KCSAN y

With clang-11:

$ scripts/diffconfig /boot/config-5.7.0-rc7-2-amd64-clang .config
BUILD_SALT "5.7.0-rc7-2-amd64-clang" -> "5.7.0-rc7-3-amd64-clang"
CLANG_VERSION 100001 -> 110000
+CC_HAS_ASM_INLINE y
+HAVE_ARCH_KCSAN y
+HAVE_KCSAN_COMPILER y
+KCSAN n

Which KCSAN kconfigs did you enable?

- Sedat -