From: "Jan Beulich" <JBeulich@suse.com>
To: <akpm@linux-foundation.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH v2] consolidate WARN_...ONCE() static variables
Date: Mon, 27 Feb 2012 15:10:34 +0000 [thread overview]
Message-ID: <4F4BAAFA0200007800074F8F@nat28.tlf.novell.com> (raw)
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.
v2: 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>
---
include/asm-generic/bug.h | 6 +++---
include/asm-generic/vmlinux.lds.h | 1 +
include/linux/rcupdate.h | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
--- 3.3-rc5/include/asm-generic/bug.h
+++ 3.3-rc5-warn-once-flag-cold/include/asm-generic/bug.h
@@ -134,7 +134,7 @@ extern void warn_slowpath_null(const cha
#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 cha
})
#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 cha
})
#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)) \
--- 3.3-rc5/include/asm-generic/vmlinux.lds.h
+++ 3.3-rc5-warn-once-flag-cold/include/asm-generic/vmlinux.lds.h
@@ -167,6 +167,7 @@
CPU_KEEP(exit.data) \
MEM_KEEP(init.data) \
MEM_KEEP(exit.data) \
+ *(.data.unlikely) \
STRUCT_ALIGN(); \
*(__tracepoints) \
/* implement dynamic printk debug */ \
--- 3.3-rc5/include/linux/rcupdate.h
+++ 3.3-rc5-warn-once-flag-cold/include/linux/rcupdate.h
@@ -374,7 +374,7 @@ extern int rcu_my_thread_group_empty(voi
*/
#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); \
next reply other threads:[~2012-02-27 15:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-27 15:10 Jan Beulich [this message]
2012-02-28 0:03 ` Andrew Morton
2012-02-28 7:41 ` Jan Beulich
2012-02-28 7:44 ` Andrew Morton
2012-02-28 8:02 ` Jan Beulich
2012-02-28 8:12 ` Andrew Morton
2012-02-28 8:16 ` Jan Beulich
2012-02-28 8:32 ` Andrew Morton
2012-02-28 8:58 ` Jan Beulich
2012-02-28 21:19 ` Andrew Morton
2012-02-29 8:21 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F4BAAFA0200007800074F8F@nat28.tlf.novell.com \
--to=jbeulich@suse.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®