Revert "kbuild: use -Oz instead of -Os when using clang"
diff mbox series

Message ID CAG5bF+RvumzKK0E-GAT223jnBvkRe1RN_0J9cGpfPOqCBvfWyw@mail.gmail.com
State New
Headers show
Series
  • Revert "kbuild: use -Oz instead of -Os when using clang"
Related show

Commit Message

Matthias Kaehlcke March 18, 2019, 9:10 p.m. UTC
The clang option -Oz enables *aggressive* optimization for size,
which doesn't necessarily result in smaller images, but can have
negative impact on performance. Switch back to the less aggressive
-Os.

This reverts commit 6748cb3c299de1ffbe56733647b01dbcc398c419.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nick Desaulniers March 18, 2019, 9:47 p.m. UTC | #1
On Mon, Mar 18, 2019 at 2:10 PM Matthias Kaehlcke <mka@chromium.org> wrote:
>
> The clang option -Oz enables *aggressive* optimization for size,
> which doesn't necessarily result in smaller images, but can have
> negative impact on performance. Switch back to the less aggressive
> -Os.
>
> This reverts commit 6748cb3c299de1ffbe56733647b01dbcc398c419.

Does scripts/checkpatch.pl complain about this format (full sha, no
title)?  Not sure that necessitates a v2, but if so would be good to
mention that Clang generates excessive calls into libgcc/compiler-rt
at -Oz.  Thanks for the patch and the discussion/sanity check.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

>
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 9ef547fc7ffe..191f3ce3cb5e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -667,7 +667,7 @@ KBUILD_CFLAGS       += $(call cc-disable-warning, format-overflow)
>  KBUILD_CFLAGS  += $(call cc-disable-warning, int-in-bool-context)
>
>  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
> -KBUILD_CFLAGS  += $(call cc-option,-Oz,-Os)
> +KBUILD_CFLAGS  += -Os
>  else
>  KBUILD_CFLAGS   += -O2
>  endif
> --
> 2.21.0.225.g810b269d1ac-goog
Matthias Kaehlcke March 18, 2019, 9:56 p.m. UTC | #2
On Mon, Mar 18, 2019 at 02:47:13PM -0700, 'Nick Desaulniers' via Clang Built Linux wrote:
> On Mon, Mar 18, 2019 at 2:10 PM Matthias Kaehlcke <mka@chromium.org> wrote:
> >
> > The clang option -Oz enables *aggressive* optimization for size,
> > which doesn't necessarily result in smaller images, but can have
> > negative impact on performance. Switch back to the less aggressive
> > -Os.
> >
> > This reverts commit 6748cb3c299de1ffbe56733647b01dbcc398c419.
> 
> Does scripts/checkpatch.pl complain about this format (full sha, no
> title)?

Nope, for reverts checkpatch is happy with it, I suppose because by
default the subject of the reverted patch is part of the revert's
subject.

> Not sure that necessitates a v2, but if so would be good to
> mention that Clang generates excessive calls into libgcc/compiler-rt
> at -Oz.  Thanks for the patch and the discussion/sanity check.

I can send a v2 if 'needed'.

> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

Thanks!

Matthias

> >
> > Suggested-by: Peter Zijlstra <peterz@infradead.org>
> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> > ---
> >  Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 9ef547fc7ffe..191f3ce3cb5e 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -667,7 +667,7 @@ KBUILD_CFLAGS       += $(call cc-disable-warning, format-overflow)
> >  KBUILD_CFLAGS  += $(call cc-disable-warning, int-in-bool-context)
> >
> >  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
> > -KBUILD_CFLAGS  += $(call cc-option,-Oz,-Os)
> > +KBUILD_CFLAGS  += -Os
> >  else
> >  KBUILD_CFLAGS   += -O2
> >  endif
> 
> 
>
H. Peter Anvin March 18, 2019, 10:07 p.m. UTC | #3
On March 18, 2019 2:56:05 PM PDT, Matthias Kaehlcke <mka@chromium.org> wrote:
>On Mon, Mar 18, 2019 at 02:47:13PM -0700, 'Nick Desaulniers' via Clang
>Built Linux wrote:
>> On Mon, Mar 18, 2019 at 2:10 PM Matthias Kaehlcke <mka@chromium.org>
>wrote:
>> >
>> > The clang option -Oz enables *aggressive* optimization for size,
>> > which doesn't necessarily result in smaller images, but can have
>> > negative impact on performance. Switch back to the less aggressive
>> > -Os.
>> >
>> > This reverts commit 6748cb3c299de1ffbe56733647b01dbcc398c419.
>> 
>> Does scripts/checkpatch.pl complain about this format (full sha, no
>> title)?
>
>Nope, for reverts checkpatch is happy with it, I suppose because by
>default the subject of the reverted patch is part of the revert's
>subject.
>
>> Not sure that necessitates a v2, but if so would be good to
>> mention that Clang generates excessive calls into libgcc/compiler-rt
>> at -Oz.  Thanks for the patch and the discussion/sanity check.
>
>I can send a v2 if 'needed'.
>
>> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>
>Thanks!
>
>Matthias
>
>> >
>> > Suggested-by: Peter Zijlstra <peterz@infradead.org>
>> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
>> > ---
>> >  Makefile | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/Makefile b/Makefile
>> > index 9ef547fc7ffe..191f3ce3cb5e 100644
>> > --- a/Makefile
>> > +++ b/Makefile
>> > @@ -667,7 +667,7 @@ KBUILD_CFLAGS       += $(call
>cc-disable-warning, format-overflow)
>> >  KBUILD_CFLAGS  += $(call cc-disable-warning, int-in-bool-context)
>> >
>> >  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
>> > -KBUILD_CFLAGS  += $(call cc-option,-Oz,-Os)
>> > +KBUILD_CFLAGS  += -Os
>> >  else
>> >  KBUILD_CFLAGS   += -O2
>> >  endif
>> 
>> 
>> 

Would be nice, still, to have -Ok.
Nick Desaulniers March 18, 2019, 10:23 p.m. UTC | #4
On Mon, Mar 18, 2019 at 3:07 PM <hpa@zytor.com> wrote:
>
> On March 18, 2019 2:56:05 PM PDT, Matthias Kaehlcke <mka@chromium.org> wrote:
> >> >  KBUILD_CFLAGS  += $(call cc-disable-warning, int-in-bool-context)
> >> >
> >> >  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
> >> > -KBUILD_CFLAGS  += $(call cc-option,-Oz,-Os)
> >> > +KBUILD_CFLAGS  += -Os
> >> >  else
> >> >  KBUILD_CFLAGS   += -O2
> >> >  endif
>
> Would be nice, still, to have -Ok.

April fools *is* coming up. 0:-)
Masahiro Yamada March 20, 2019, 1:28 p.m. UTC | #5
On Tue, Mar 19, 2019 at 6:10 AM Matthias Kaehlcke <mka@chromium.org> wrote:
>
> The clang option -Oz enables *aggressive* optimization for size,
> which doesn't necessarily result in smaller images, but can have
> negative impact on performance. Switch back to the less aggressive
> -Os.
>
> This reverts commit 6748cb3c299de1ffbe56733647b01dbcc398c419.
>
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>


Applied to linux-kbuild/fixes.  Thanks.


> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 9ef547fc7ffe..191f3ce3cb5e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -667,7 +667,7 @@ KBUILD_CFLAGS       += $(call cc-disable-warning, format-overflow)
>  KBUILD_CFLAGS  += $(call cc-disable-warning, int-in-bool-context)
>
>  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
> -KBUILD_CFLAGS  += $(call cc-option,-Oz,-Os)
> +KBUILD_CFLAGS  += -Os
>  else
>  KBUILD_CFLAGS   += -O2
>  endif
> --
> 2.21.0.225.g810b269d1ac-goog

Patch
diff mbox series

diff --git a/Makefile b/Makefile
index 9ef547fc7ffe..191f3ce3cb5e 100644
--- a/Makefile
+++ b/Makefile
@@ -667,7 +667,7 @@  KBUILD_CFLAGS	+= $(call cc-disable-warning, format-overflow)
 KBUILD_CFLAGS	+= $(call cc-disable-warning, int-in-bool-context)

 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS	+= $(call cc-option,-Oz,-Os)
+KBUILD_CFLAGS	+= -Os
 else
 KBUILD_CFLAGS   += -O2
 endif