Commit 60a3cdd06394 ("x86: add optimized inlining") introduced CONFIG_OPTIMIZE_INLINING, but it has been available only for x86. The idea is obviously arch-agnostic. This commit moves the config entry from arch/x86/Kconfig.debug to lib/Kconfig.debug so that all architectures can benefit from it. This can make a huge difference in kernel image size especially when CONFIG_OPTIMIZE_FOR_SIZE is enabled. For example, I got 3.5% smaller arm64 kernel for v5.1-rc1. dec file 18983424 arch/arm64/boot/Image.before 18321920 arch/arm64/boot/Image.after This also slightly improves the "Kernel hacking" Kconfig menu as e61aca5158a8 ("Merge branch 'kconfig-diet' from Dave Hansen') suggested; this config option would be a good fit in the "compiler option" menu.
Unified · Split
| @@ -305,9 +305,6 @@ config ZONE_DMA32 · 304 unmodified lines | ||
| 305 | 305 | config AUDIT_ARCH |
| 306 | 306 | def_bool y if X86_64 |
| 307 | 307 | |
| 308 | −config ARCH_SUPPORTS_OPTIMIZED_INLINING | |
| 309 | − def_bool y | |
| 310 | − | |
| 311 | 308 | config ARCH_SUPPORTS_DEBUG_PAGEALLOC |
| 312 | 309 | def_bool y |
| 313 | 310 | |
| @@ -266,20 +266,6 @@ config CPA_DEBUG · 265 unmodified lines | ||
| 266 | 266 | ---help--- |
| 267 | 267 | Do change_page_attr() self-tests every 30 seconds. |
| 268 | 268 | |
| 269 | −config OPTIMIZE_INLINING | |
| 270 | − bool "Allow gcc to uninline functions marked 'inline'" | |
| 271 | − ---help--- | |
| 272 | − This option determines if the kernel forces gcc to inline the functions | |
| 273 | − developers have marked 'inline'. Doing so takes away freedom from gcc to | |
| 274 | − do what it thinks is best, which is desirable for the gcc 3.x series of | |
| 275 | − compilers. The gcc 4.x series have a rewritten inlining algorithm and | |
| 276 | − enabling this option will generate a smaller kernel there. Hopefully | |
| 277 | − this algorithm is so good that allowing gcc 4.x and above to make the | |
| 278 | − decision will become the default in the future. Until then this option | |
| 279 | − is there to test gcc for this. | |
| 280 | − | |
| 281 | − If unsure, say N. | |
| 282 | − | |
| 283 | 269 | config DEBUG_ENTRY |
| 284 | 270 | bool "Debug low-level entry code" |
| 285 | 271 | depends on DEBUG_KERNEL |
| @@ -140,8 +140,7 @@ struct ftrace_likely_data { · 139 unmodified lines | ||
| 140 | 140 | * Do not use __always_inline here, since currently it expands to inline again |
| 141 | 141 | * (which would break users of __always_inline). |
| 142 | 142 | */ |
| 143 | −#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ | |
| 144 | − !defined(CONFIG_OPTIMIZE_INLINING) | |
| 143 | +#if !defined(CONFIG_OPTIMIZE_INLINING) | |
| 145 | 144 | #define inline inline __attribute__((__always_inline__)) __gnu_inline \ |
| 146 | 145 | __maybe_unused notrace |
| 147 | 146 | #else |
| @@ -318,6 +318,20 @@ config HEADERS_CHECK · 317 unmodified lines | ||
| 318 | 318 | exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in |
| 319 | 319 | your build tree), to make sure they're suitable. |
| 320 | 320 | |
| 321 | +config OPTIMIZE_INLINING | |
| 322 | + bool "Allow compiler to uninline functions marked 'inline'" | |
| 323 | + help | |
| 324 | + This option determines if the kernel forces gcc to inline the functions | |
| 325 | + developers have marked 'inline'. Doing so takes away freedom from gcc to | |
| 326 | + do what it thinks is best, which is desirable for the gcc 3.x series of | |
| 327 | + compilers. The gcc 4.x series have a rewritten inlining algorithm and | |
| 328 | + enabling this option will generate a smaller kernel there. Hopefully | |
| 329 | + this algorithm is so good that allowing gcc 4.x and above to make the | |
| 330 | + decision will become the default in the future. Until then this option | |
| 331 | + is there to test gcc for this. | |
| 332 | + | |
| 333 | + If unsure, say N. | |
| 334 | + | |
| 321 | 335 | config DEBUG_SECTION_MISMATCH |
| 322 | 336 | bool "Enable full Section mismatch analysis" |
| 323 | 337 | help |