220-optimize_inlining.patch 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. --- a/arch/arm/kernel/atags.h
  2. +++ b/arch/arm/kernel/atags.h
  3. @@ -5,7 +5,7 @@ void convert_to_tag_list(struct tag *tag
  4. const struct machine_desc *setup_machine_tags(phys_addr_t __atags_pointer,
  5. unsigned int machine_nr);
  6. #else
  7. -static inline const struct machine_desc *
  8. +static inline const struct machine_desc * __init __noreturn
  9. setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr)
  10. {
  11. early_print("no ATAGS support: can't continue\n");
  12. --- a/arch/arm64/include/asm/cpufeature.h
  13. +++ b/arch/arm64/include/asm/cpufeature.h
  14. @@ -347,7 +347,7 @@ static inline bool cpu_have_feature(unsi
  15. }
  16. /* System capability check for constant caps */
  17. -static inline bool __cpus_have_const_cap(int num)
  18. +static __always_inline bool __cpus_have_const_cap(int num)
  19. {
  20. if (num >= ARM64_NCAPS)
  21. return false;
  22. @@ -361,7 +361,7 @@ static inline bool cpus_have_cap(unsigne
  23. return test_bit(num, cpu_hwcaps);
  24. }
  25. -static inline bool cpus_have_const_cap(int num)
  26. +static __always_inline bool cpus_have_const_cap(int num)
  27. {
  28. if (static_branch_likely(&arm64_const_caps_ready))
  29. return __cpus_have_const_cap(num);
  30. --- a/arch/mips/include/asm/bitops.h
  31. +++ b/arch/mips/include/asm/bitops.h
  32. @@ -462,7 +462,7 @@ static inline void __clear_bit_unlock(un
  33. * Return the bit position (0..63) of the most significant 1 bit in a word
  34. * Returns -1 if no 1 bit exists
  35. */
  36. -static inline unsigned long __fls(unsigned long word)
  37. +static __always_inline unsigned long __fls(unsigned long word)
  38. {
  39. int num;
  40. @@ -528,7 +528,7 @@ static inline unsigned long __fls(unsign
  41. * Returns 0..SZLONG-1
  42. * Undefined if no bit exists, so code should check against 0 first.
  43. */
  44. -static inline unsigned long __ffs(unsigned long word)
  45. +static __always_inline unsigned long __ffs(unsigned long word)
  46. {
  47. return __fls(word & -word);
  48. }
  49. --- a/arch/mips/kernel/cpu-bugs64.c
  50. +++ b/arch/mips/kernel/cpu-bugs64.c
  51. @@ -42,8 +42,8 @@ static inline void align_mod(const int a
  52. : GCC_IMM_ASM() (align), GCC_IMM_ASM() (mod));
  53. }
  54. -static inline void mult_sh_align_mod(long *v1, long *v2, long *w,
  55. - const int align, const int mod)
  56. +static __always_inline void mult_sh_align_mod(long *v1, long *v2, long *w,
  57. + const int align, const int mod)
  58. {
  59. unsigned long flags;
  60. int m1, m2;
  61. --- a/arch/powerpc/kernel/prom_init.c
  62. +++ b/arch/powerpc/kernel/prom_init.c
  63. @@ -474,14 +474,14 @@ static int __init prom_next_node(phandle
  64. }
  65. }
  66. -static inline int prom_getprop(phandle node, const char *pname,
  67. - void *value, size_t valuelen)
  68. +static inline int __init prom_getprop(phandle node, const char *pname,
  69. + void *value, size_t valuelen)
  70. {
  71. return call_prom("getprop", 4, 1, node, ADDR(pname),
  72. (u32)(unsigned long) value, (u32) valuelen);
  73. }
  74. -static inline int prom_getproplen(phandle node, const char *pname)
  75. +static inline int __init prom_getproplen(phandle node, const char *pname)
  76. {
  77. return call_prom("getproplen", 2, 1, node, ADDR(pname));
  78. }
  79. --- a/arch/s390/include/asm/cpacf.h
  80. +++ b/arch/s390/include/asm/cpacf.h
  81. @@ -184,7 +184,7 @@ static inline int __cpacf_check_opcode(u
  82. }
  83. }
  84. -static inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
  85. +static __always_inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
  86. {
  87. if (__cpacf_check_opcode(opcode)) {
  88. __cpacf_query(opcode, mask);
  89. --- a/arch/x86/Kconfig.debug
  90. +++ b/arch/x86/Kconfig.debug
  91. @@ -284,20 +284,6 @@ config CPA_DEBUG
  92. ---help---
  93. Do change_page_attr() self-tests every 30 seconds.
  94. -config OPTIMIZE_INLINING
  95. - bool "Allow gcc to uninline functions marked 'inline'"
  96. - ---help---
  97. - This option determines if the kernel forces gcc to inline the functions
  98. - developers have marked 'inline'. Doing so takes away freedom from gcc to
  99. - do what it thinks is best, which is desirable for the gcc 3.x series of
  100. - compilers. The gcc 4.x series have a rewritten inlining algorithm and
  101. - enabling this option will generate a smaller kernel there. Hopefully
  102. - this algorithm is so good that allowing gcc 4.x and above to make the
  103. - decision will become the default in the future. Until then this option
  104. - is there to test gcc for this.
  105. -
  106. - If unsure, say N.
  107. -
  108. config DEBUG_ENTRY
  109. bool "Debug low-level entry code"
  110. depends on DEBUG_KERNEL
  111. --- a/lib/Kconfig.debug
  112. +++ b/lib/Kconfig.debug
  113. @@ -305,6 +305,20 @@ config HEADERS_CHECK
  114. exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in
  115. your build tree), to make sure they're suitable.
  116. +config OPTIMIZE_INLINING
  117. + bool "Allow compiler to uninline functions marked 'inline'"
  118. + help
  119. + This option determines if the kernel forces gcc to inline the functions
  120. + developers have marked 'inline'. Doing so takes away freedom from gcc to
  121. + do what it thinks is best, which is desirable for the gcc 3.x series of
  122. + compilers. The gcc 4.x series have a rewritten inlining algorithm and
  123. + enabling this option will generate a smaller kernel there. Hopefully
  124. + this algorithm is so good that allowing gcc 4.x and above to make the
  125. + decision will become the default in the future. Until then this option
  126. + is there to test gcc for this.
  127. +
  128. + If unsure, say N.
  129. +
  130. config DEBUG_SECTION_MISMATCH
  131. bool "Enable full Section mismatch analysis"
  132. help
  133. --- a/arch/x86/Kconfig
  134. +++ b/arch/x86/Kconfig
  135. @@ -296,9 +296,6 @@ config ZONE_DMA32
  136. config AUDIT_ARCH
  137. def_bool y if X86_64
  138. -config ARCH_SUPPORTS_OPTIMIZED_INLINING
  139. - def_bool y
  140. -
  141. config ARCH_SUPPORTS_DEBUG_PAGEALLOC
  142. def_bool y
  143. --- a/include/linux/compiler-gcc.h
  144. +++ b/include/linux/compiler-gcc.h
  145. @@ -90,8 +90,7 @@
  146. * of extern inline functions at link time.
  147. * A lot of inline functions can cause havoc with function tracing.
  148. */
  149. -#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
  150. - !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
  151. +#if !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
  152. #define inline \
  153. inline __attribute__((always_inline, unused)) notrace __gnu_inline
  154. #else