Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

consolidate WARN_...ONCE() static variables

Due to the alignment of following variables, these typically consume
more than just the single byte that 'bool' requires, and as there are a
few hundred instances, the cache pollution (not so much the waste of
memory) sums up. Put these variables into their own section, outside of
any half way frequently used memory range.

Do the same also to the __warned variable of rcu_lockdep_assert().
(Don't, however, include the ones used by printk_once() and alike, as
they can potentially be hot.)

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jan Beulich and committed by
Linus Torvalds
7ccaba53 10db4e1e

+5 -4
+3 -3
include/asm-generic/bug.h
··· 134 134 #endif 135 135 136 136 #define WARN_ON_ONCE(condition) ({ \ 137 - static bool __warned; \ 137 + static bool __section(.data.unlikely) __warned; \ 138 138 int __ret_warn_once = !!(condition); \ 139 139 \ 140 140 if (unlikely(__ret_warn_once)) \ ··· 144 144 }) 145 145 146 146 #define WARN_ONCE(condition, format...) ({ \ 147 - static bool __warned; \ 147 + static bool __section(.data.unlikely) __warned; \ 148 148 int __ret_warn_once = !!(condition); \ 149 149 \ 150 150 if (unlikely(__ret_warn_once)) \ ··· 154 154 }) 155 155 156 156 #define WARN_TAINT_ONCE(condition, taint, format...) ({ \ 157 - static bool __warned; \ 157 + static bool __section(.data.unlikely) __warned; \ 158 158 int __ret_warn_once = !!(condition); \ 159 159 \ 160 160 if (unlikely(__ret_warn_once)) \
+1
include/asm-generic/vmlinux.lds.h
··· 167 167 CPU_KEEP(exit.data) \ 168 168 MEM_KEEP(init.data) \ 169 169 MEM_KEEP(exit.data) \ 170 + *(.data.unlikely) \ 170 171 STRUCT_ALIGN(); \ 171 172 *(__tracepoints) \ 172 173 /* implement dynamic printk debug */ \
+1 -1
include/linux/rcupdate.h
··· 418 418 */ 419 419 #define rcu_lockdep_assert(c, s) \ 420 420 do { \ 421 - static bool __warned; \ 421 + static bool __section(.data.unlikely) __warned; \ 422 422 if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \ 423 423 __warned = true; \ 424 424 lockdep_rcu_suspicious(__FILE__, __LINE__, s); \