LWN: Comments on "Profile-guided optimization for the kernel" https://lwn.net/Articles/830300/ This is a special feed containing comments posted to the individual LWN article titled "Profile-guided optimization for the kernel". en-us Sat, 06 Sep 2025 18:08:31 +0000 Sat, 06 Sep 2025 18:08:31 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Profile-guided optimization for the kernel https://lwn.net/Articles/831211/ https://lwn.net/Articles/831211/ ndesaulniers <div class="FormattedComment"> We&#x27;ve reached out to Ian about collaborating on LTO integration; we&#x27;re in the process of upstreaming LTO patches for LLVM and need help from the GCC side to test and sort out what issues they might run into: <a href="https://lore.kernel.org/lkml/CAKwvOdkbkvXdfXLzTNOj8m8_YWjL6=bSn4-AbRyd-5oYGJVNSw@mail.gmail.com/T/#u">https://lore.kernel.org/lkml/CAKwvOdkbkvXdfXLzTNOj8m8_YWj...</a><br> <p> For example, LTO has exposed a handful of compiler bugs. Most recently: <a href="https://bugs.llvm.org/show_bug.cgi?id=47479">https://bugs.llvm.org/show_bug.cgi?id=47479</a>.<br> </div> Thu, 10 Sep 2020 17:49:30 +0000 Profile-guided optimization for the kernel https://lwn.net/Articles/830691/ https://lwn.net/Articles/830691/ nivedita76 <div class="FormattedComment"> Don&#x27;t know any details, but the LLVM pass sounds similar to gcc&#x27;s -freorder-blocks-and-partition<br> <p> In addition to reordering basic blocks in the compiled function, in order to reduce number of taken branches, partitions hot and cold basic blocks into separate sections of the assembly and .o files, to improve paging and cache locality performance.<br> </div> Fri, 04 Sep 2020 22:09:40 +0000 Profile-guided optimization for the kernel https://lwn.net/Articles/830574/ https://lwn.net/Articles/830574/ rbrito <div class="FormattedComment"> I am eagerly waiting for kernels to be regularly compiled with link-time optimization at least, since the prospects of it generating smaller binaries could help a lot with booting more armv5 machines (the space for the kernel file is limited when loading it with the bootloader).<br> <p> If the kernel also happens to use fewer bytes in memory, that is a very nice side effect that could be left to userspace in memory constrained machines, so much better. In fact, this would also help with the kernel that phones use (I&#x27;m thinking of lineageos here). A leaner kernel would mean less thrashing, which can only be a good thing. I hope that Apps that use NDK can also switch to LTO in the relatively near future.<br> <p> Having distribution kernels with PGO for regular computers enabled seems to also be very nice. I really, really hope that we&#x27;re not far from that being the bread-and-butter of kernel compilation.<br> <p> Also talking about compiler optimizations, in the last few days I read about a new approach that was just merged in (see <a href="https://github.com/llvm/llvm-project/commit/94faadac">https://github.com/llvm/llvm-project/commit/94faadac</a>) LLVM called machine function splitter. It seems to be roughly based on the observation that not all hot functions have all their parts hot. It would be lovely to get something similar in GCC.<br> <p> In fact, if you think about it, many of the optimizations (like reducing the code for little machines like armv5) may also help significantly the code for big, compute-intensive, cloud applications and, so, everyone would benefit from that...<br> <p> </div> Fri, 04 Sep 2020 05:06:24 +0000