Re: Exporting cpu instruction set to kernel .config file

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

 



On Thu, Mar 03, 2022 at 09:52:50PM -0300, Rogério Valentim Feitoza da Silva wrote:
> No kernel should be compiled with compiler optimization, because the compiler
> might remove CPU instructions and code that might look "unnecessary" but
> are actually required.

IIRC a lot of the kernel is compiled with -O2.  You could increase it,
but it's not necessarily a good idea:

On Mon, May 11, 2020 at 05:04:56PM -0700, Linus Torvalds wrote:
> I'm not convinced this is sensible.
>
> -O3 historically does bad things with gcc. Including bad things for
> performance. It traditionally makes code larger and often SLOWER.
>
> And I don't mean slower to compile (although that's an issue). I mean
> actually generating slower code.
>
> Things like trying to unroll loops etc makes very little sense in the
> kernel, where we very seldom have high loop counts for pretty much
> anything.
>
> There's a reason -O3 isn't even offered as an option.
>
> Maybe things have changed, and maybe they've improved. But I'd like to
> see actual numbers for something like this.
>
> Not inlining as aggressively is not necessarily a bad thing. It can
> be, of course. But I've actually also done gcc bugreports about gcc
> inlining too much, and generating _worse_ code as a result (ie
> inlinging things that were behind an "if (unlikely())" test, and
> causing the likely path to grow a stack fram and stack spills as a
> result).
>
> So just "O3 inlines more" is not a valid argument.
--
https://lore.kernel.org/lkml/CAHk-=wi87j=wj0ijkYZ3WoPVkZ9Fq1U2bLnQ66nk425B5kW0Cw@xxxxxxxxxxxxxx/

On the other hand, decreasing it is also probably not a good idea.

Torin


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux