Announcement

Collapse
No announcement yet.

Link-Time Optimization To Speed Up The Linux Kernel

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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?

    Comment


    • #3
      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.

      Comment


      • #4
        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).

        Comment


        • #5
          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.

          Comment


          • #6
            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

            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, 01:23 PM.

            Comment


            • #7
              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.

              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?

              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

              Comment


              • #8
                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.

                Comment


                • #9
                  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

                  Comment


                  • #10
                    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.

                    Comment


                    • #11
                      Originally posted by uid313 View Post
                      Isn't GCC-specific behavior bad?
                      No. It's designed that way. The GCC-specific code isn't an accident or oversight.

                      Shouldn't it be ANSI/ISO-compatible?
                      Nope. Linux is specifically targetting GCC as it's compiler.

                      Comment


                      • #12
                        Originally posted by RealNC View Post
                        No. It's designed that way. The GCC-specific code isn't an accident or oversight.
                        Maybe those GCC-specific extensions should be sent to ISO for standarization.

                        Comment


                        • #13
                          Yeah, and be standardized in C25 in 2025...

                          Comment


                          • #14
                            Originally posted by curaga View Post
                            Yeah, and be standardized in C25 in 2025...
                            Better late than never?

                            Comment


                            • #15
                              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
                              hahahahahahahhahahaha good fucking luck, buddy.

                              (For more context, Microsoft does not support or enhance their C compiler anymore, which hasn't been able to compile many modern C codebases in ages. It's stuck at the 23-year-old C89 standard and is receiving zero further development support. Microsoft tells anyone who runs into problems to compile as C++ or to go find another compiler vendor. I'd be mildly surprised if Microsoft's compiler can even successfully parse more than 25% of the headers in Linux or even a single source file.)

                              Maybe those GCC-specific extensions should be sent to ISO for standarization.
                              Many of the extensions are just not really general-C kinds of things. http://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html - if you look through that list, and especially at the ones the Linux kernel depends on, they're not really applicable in the kind of general sense that C prefers. Some of them place extra restrictions on the compiler's code generator which would make them unusable on "small system" C compilers, others are very tightly bound to the linker and require an ELF-like system, some are hardware or platform specific, some are specific to GCC's internals, and yet others are just of dubious nature that may have already been superceded by C11 or C++ equivalents. (Note that many of those extensions actually are just C99 or C11 features, with the "extension" part being that GCC accepts them even when compiling in older standards modes.)

                              Comment

                              Working...
                              X