Page 1 of 3 123 LastLast
Results 1 to 10 of 30

Thread: Link-Time Optimization To Speed Up The Linux Kernel

  1. #1
    Join Date
    Jan 2007
    Posts
    14,359

    Default Link-Time Optimization To Speed Up The Linux Kernel

    Phoronix: Link-Time Optimization To Speed Up The Linux Kernel

    An extensive set of patches have been published that allow the Linux kernel to be built with GCC's LTO (Link-Time Optimization) support for generating a faster Linux kernel binary but at the cost of much greater compile times...

    http://www.phoronix.com/vr.php?view=MTE2MzY

  2. #2
    Join Date
    Dec 2011
    Posts
    2,006

    Default LLVM

    On related note, how much progress has been on LLVM to compile Linux?
    I remember hearing attempts to make LLVM compile Linux before.

    I know GCC is much faster than LLVM.
    But what is the status of Linux on LLVM?

  3. #3
    Join Date
    Feb 2008
    Location
    Linuxland
    Posts
    4,994

    Default

    Very nice, I'd like to see this in.

    OTOH, I recall Denys Vlasenko's similar patchset earlier to enable the kernel to build with -ffunction-sections -fdata-sections (resulting in 10-15% smaller binary) was not merged.

  4. #4
    Join Date
    May 2012
    Posts
    765

    Default

    Quote Originally Posted by uid313 View Post
    On related note, how much progress has been on LLVM to compile Linux?
    I remember hearing attempts to make LLVM compile Linux before.

    I know GCC is much faster than LLVM.
    But what is the status of Linux on LLVM?
    Afaik LLVM is mostly driven by Apple and Apple has no interest in making LLVM build the Linux kernel.

    Since Linux uses GCC specific behavior I'd expect LLVM to take several years (if ever) until it's good enough to be used by default mainstream.

    The need for a new compiler for Linux is exaggerated and over-appreciated (like Facebook hehe), GCC is good enough and improving (being cleaned up, moving to C++, LTO).

  5. #5
    Join Date
    Sep 2008
    Location
    Vilnius, Lithuania
    Posts
    2,523

    Default

    Well, that's interesting. Once this gets implemented, it will be awesome news for slow devices on Gentoo using distcc. Also, you could compile a kernel normally, see if it works out right, and then in spare time compile it with the optimizations. I just wonder how much difference they'll make.

  6. #6
    Join Date
    Jun 2011
    Posts
    827

    Default

    Quote Originally Posted by uid313 View Post
    On related note, how much progress has been on LLVM to compile Linux?
    I remember hearing attempts to make LLVM compile Linux before.

    I know GCC is much faster than LLVM.
    But what is the status of Linux on LLVM?
    https://aur.archlinux.org/packages.php?ID=45733

    People have been messing around with the LLVM + linux kernel combo for a long time via the work done at the University of Illinois...

    There also happens to be this project, that consolidates that work (the lll work) and others;

    http://llvm.linuxfoundation.org/index.php/Main_Page

    Quote Originally Posted by mark45 View Post
    Afaik LLVM is mostly driven by Apple and Apple has no interest in making LLVM build the Linux kernel.
    it doesn't require Apple's blessing, nor them to do the work in order for LLVM to build the kernel. They also don't happen to be the only company/party using LLVM, nor the only company/party contributing to CLang/LLVM. What it actually requires is people hacking on code (both Linux kernel and Clang/LLVM code), fixing issues and then submitting their patches upstream to both projects,
    Last edited by ninez; 08-19-2012 at 01:23 PM.

  7. #7
    Join Date
    Dec 2011
    Posts
    2,006

    Default

    Quote Originally Posted by mark45 View Post
    Afaik LLVM is mostly driven by Apple and Apple has no interest in making LLVM build the Linux kernel.
    But there have been attempts to make Linux compile under LLVM (or was it Intel C Compiler?).
    Someone managed to compile parts of it, not all, and maybe with some patches.

    Some people in the Linux community are interested in seeing Linux compile under LLVM, because it is argued that having Linux compile under many compilers will improve code quality.

    Quote Originally Posted by mark45 View Post
    Since Linux uses GCC specific behavior I'd expect LLVM to take several years (if ever) until it's good enough to be used by default mainstream.
    Isn't GCC-specific behavior bad?
    Shouldn't it be ANSI/ISO-compatible?

    Quote Originally Posted by mark45 View Post
    The need for a new compiler for Linux is exaggerated and over-appreciated (like Facebook hehe), GCC is good enough and improving (being cleaned up, moving to C++, LTO).
    Yeah, I know. GCC is much faster than LLVM.
    But would be nice if Linux compiled cleanly with several compilers.

    I'd like to see someone try compile Linux with;
    * GCC
    * Microsoft Compiler
    * LLVM / Clang / DragonEgg
    * PCC, TCC
    * Intel C Compiler
    * Open64

  8. #8
    Join Date
    Jun 2011
    Posts
    827

    Default

    Quote Originally Posted by uid313 View Post
    I'd like to see someone try compile Linux with;
    * GCC
    * Microsoft Compiler
    * LLVM / Clang / DragonEgg
    * PCC, TCC
    * Intel C Compiler
    * Open64
    Out of those, i personally have used GCC (obviously), ICC (intel C compiler) and Clang/LLVM (using the lll-project listed above) to successfully compile the linux kernel.

    I think i may have also tried Open64 5.0 but it failed. The rest i have not tried but would assume they would all fail OOTB.

  9. #9
    Join Date
    Apr 2012
    Posts
    22

    Default Debian & Gentoo

    Hi,

    Debian already have plans to switch to LLVM and Gentoo is talking about. The big isssue seems the GNU useland.

    Gentoo Forum
    Gentoo BugTracker
    Debian Package Rebuild


  10. #10
    Join Date
    Oct 2009
    Posts
    845

    Default

    Quote Originally Posted by uid313 View Post
    Isn't GCC-specific behavior bad?
    For portability between compilers, yes. However this is the result of the kernel using compiler extensions which allow a much higher degree of control regarding the generated code, resulting in much better efficiency than letting the compiler do it's guess-work.

    Also since many of these GCC compiler extensions were added at the direct request of the kernel developers there's little chance they would decide to suddenly go without them. Also the Linux kernel devs are very performance oriented and I doubt they would forego any efficiency in order to ease porting to other compiler toolchains.

    While perfect portability between compilers would be nice, it's really not much of a practical problem since GCC is ported to everything. Also giving up efficiency of generated code in order to have it compiling with compiler X is likely not something end-users would find attractive either.

    And then there's nothing preventing other compilers from supporting said extensions, and for the record all compilers supports a variety of compiler extensions, some are cross-supported and some are exclusive.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •