consolidate WARN_...ONCE() static variables
authorJan Beulich <JBeulich@suse.com>
Fri, 23 Mar 2012 22:01:52 +0000 (15:01 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 23 Mar 2012 23:58:31 +0000 (16:58 -0700)
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>
include/asm-generic/bug.h
include/asm-generic/vmlinux.lds.h
include/linux/rcupdate.h

index 84458b0c38d15f76fc100447a88291b5256a02ae..2520a6e241dc0967ef7f8e096436a19a6042e36a 100644 (file)
@@ -134,7 +134,7 @@ extern void warn_slowpath_null(const char *file, const int line);
 #endif
 
 #define WARN_ON_ONCE(condition)        ({                              \
-       static bool __warned;                                   \
+       static bool __section(.data.unlikely) __warned;         \
        int __ret_warn_once = !!(condition);                    \
                                                                \
        if (unlikely(__ret_warn_once))                          \
@@ -144,7 +144,7 @@ extern void warn_slowpath_null(const char *file, const int line);
 })
 
 #define WARN_ONCE(condition, format...)        ({                      \
-       static bool __warned;                                   \
+       static bool __section(.data.unlikely) __warned;         \
        int __ret_warn_once = !!(condition);                    \
                                                                \
        if (unlikely(__ret_warn_once))                          \
@@ -154,7 +154,7 @@ extern void warn_slowpath_null(const char *file, const int line);
 })
 
 #define WARN_TAINT_ONCE(condition, taint, format...)   ({      \
-       static bool __warned;                                   \
+       static bool __section(.data.unlikely) __warned;         \
        int __ret_warn_once = !!(condition);                    \
                                                                \
        if (unlikely(__ret_warn_once))                          \
index b5e2e4c6b017c98d89b859b4190e2a373e18b9e0..798603e8ec38e017e342fff7d4e2ea536ed42922 100644 (file)
        CPU_KEEP(exit.data)                                             \
        MEM_KEEP(init.data)                                             \
        MEM_KEEP(exit.data)                                             \
+       *(.data.unlikely)                                               \
        STRUCT_ALIGN();                                                 \
        *(__tracepoints)                                                \
        /* implement dynamic printk debug */                            \
index 937217425c47e1003b8c735c9b391d3d19c57df9..2c62594b67ddd65fd6602b1534f3f62019cc7619 100644 (file)
@@ -418,7 +418,7 @@ extern int rcu_my_thread_group_empty(void);
  */
 #define rcu_lockdep_assert(c, s)                                       \
        do {                                                            \
-               static bool __warned;                                   \
+               static bool __section(.data.unlikely) __warned;         \
                if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \
                        __warned = true;                                \
                        lockdep_rcu_suspicious(__FILE__, __LINE__, s);  \