public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] consolidate WARN_...ONCE() static variables
@ 2011-12-22 15:53 Jan Beulich
  2011-12-22 17:13 ` Arnaud Lacombe
  2012-01-04 23:03 ` Andrew Morton
  0 siblings, 2 replies; 9+ messages in thread
From: Jan Beulich @ 2011-12-22 15:53 UTC (permalink / raw)
  To: akpm, Michal Marek; +Cc: linux-kbuild

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 op. Put these variables into their own section, outside
of half way frequently used memory range.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

---
 include/asm-generic/bug.h         |    6 +++---
 include/asm-generic/vmlinux.lds.h |    1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

--- 3.2-rc6/include/asm-generic/bug.h
+++ 3.2-rc6-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.2-rc6/include/asm-generic/vmlinux.lds.h
+++ 3.2-rc6-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 */				\




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-01-06 12:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-22 15:53 [PATCH] consolidate WARN_...ONCE() static variables Jan Beulich
2011-12-22 17:13 ` Arnaud Lacombe
2011-12-23  7:52   ` Jan Beulich
2012-01-04 23:03 ` Andrew Morton
2012-01-05 11:09   ` Jan Beulich
2012-01-05 21:03     ` Andrew Morton
2012-01-06  7:40       ` Jan Beulich
2012-01-06 11:03         ` Andrew Morton
2012-01-06 12:38           ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox