In Linux, the keyword "__always_inline" forces a function to be inlined, and "noinline" prevents a function from being inlined. We don't use the "inline" keyword because it's broken.

Inline functions are similar to macros in that the code in them is copied into the calling function without the overhead of a function call, but without a macro's tortured syntax or lack of typechecking. Like macros, inline functions are usually located in header files, because the compiler can only inline source code, not object code.

Judicious use of inline functions can produce better code, not just faster but sometimes even smaller due to extra opportunities for compiler optimization. And some esoteric tasks (generally requiring the use of assembly code, such as setjmp and certain kinds of locking) must be performed inline or they won't work right.

In theory, the keyword to do this is "inline". In practice, this keyword is broken on newer versions of gcc. Current versions of gcc turned "inline" into a request (similar to the old "register" keyword), rendering it essentially useless. These versions of gcc are free to ignore any such requests to inline functions, as well as to inline functions without the keyword.

The problem with this is that to be effective, inline functions must be defined in header files (since inlining is done by the compiler, not the linker, it must be done on source code not object files). But even when every use of a function is inlined, an unused non-inline version of the function can still be produced and linked "just in case". If multiple .c files #include the same header, this can even result in multiple non-inline versions of the same function being passed to the linker.

Earlier attempts to work around this breakage by declaring functions "static inline" or "extern inline" (instructing the compiler never to emit a non-inline version of the function, breaking the build if necessary to detect when the compiler wasn't following instructions) worked for a while, but were again broken by newer releases of gcc.

The __always_inline macro contains the current way to force gcc to do what it's told: to actually inline a function everywhere it's used, and not emit a redundant non-inlined copy. (On compilers that aren't broken, it can simply be #defined to "inline".)

The noinline macro tells gcc a function should never be inlined. This is used to keep functions called from the _init section from being discarded while they're still in use.

See for backstory. The __always_inline macro showed up in 2.6.16.

Further discussion: