Re: [PATCH] consolidate WARN_...ONCE() static variables

From: Jan Beulich
Date: Fri Dec 23 2011 - 02:52:11 EST


>>> On 22.12.11 at 18:13, Arnaud Lacombe <lacombar@xxxxxxxxx> wrote:
> On Thu, Dec 22, 2011 at 10:53 AM, Jan Beulich <JBeulich@xxxxxxxx> wrote:
>> 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.
>>
> how does this relates to kbuild exactly ? I see you did not even CC'ed LKML.

In touching include/asm-generic/vmlinux.lds.h (and not touching
anything outside include/asm-generic/).

And I wasn't aware that any subsystem change needs to go to lkml too;
adding that list now.

> btw, it might be interesting to have numbers backing this change :)

Sort of difficult, as this (obviously) varies by configuration. But as
stated, it's generally a few hundred instances. Additionally, I find it
odd that any small and obvious (at least I view is as such, and it
should have been coded this way from the beginning) improvement
is being asked to be backed by precise numbers.

The one thing I wasn't sure about was whether this shouldn't be done
in a more abstract way, to allow use in other places as well. But such
abstraction can certainly be added incrementally.

Jan

>> --- 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 */ \
>>
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> More majordomo info at http://vger.kernel.org/majordomo-info.html



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/