bug: When !CONFIG_BUG, simplify WARN_ON_ONCE and family
Subsystems (2)
PATCH v2 1/5 bug: When !CONFIG_BUG, simplify WARN_ON_ONCE and family
When !CONFIG_BUG, WARN_ON and family become simple passthroughs of their condition argument; however, WARN_ON_ONCE and family still have conditions and a boolean to detect one-time invocation, even though the warning they'd emit doesn't exist. Make the existing definitions conditional on CONFIG_BUG, and add definitions for !CONFIG_BUG that map to the passthrough versions of WARN and WARN_ON.
This saves 4.4k on a minimized configuration (smaller than allnoconfig), and 20.6k with defconfig plus CONFIG_BUG=n.
---
v2: Incorporate feedback from Arnd Bergmann: make the WARN_* variants with
format strings and arguments call WARN and pass along those arguments, rather than calling WARN_ON. Used by the new patch 3, which makes the stub version of WARN call no_printk.
include/asm-generic/bug.h | 57 +++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 27 deletions(-)
include/asm-generic/bug.h +30 -27
@@ -106,33 +106,6 @@ extern void warn_slowpath_null(const char *file, const int line);unlikely (__ret_warn_on); \ }) -#else /* !CONFIG_BUG */ -#ifndef HAVE_ARCH_BUG -#define BUG () do {} while(0) -#endif - -#ifndef HAVE_ARCH_BUG_ON -#define BUG_ON (condition) do { if (condition) ; } while(0) -#endif - -#ifndef HAVE_ARCH_WARN_ON -#define WARN_ON (condition) ({ \ - int __ret_warn_on = !!(condition); \ - unlikely(__ret_warn_on); \ -}) -#endif - -#ifndef WARN -#define WARN(condition, format...) ({ \ - int __ret_warn_on = !!(condition); \ - unlikely(__ret_warn_on); \ -}) -#endif - -#define WARN_TAINT(condition, taint, format...) WARN_ON(condition) - -#endif -#define WARN_ON_ONCE (condition) ({ \ static bool __section(.data.unlikely) __warned; \ int __ret_warn_once = !!(condition); \
@@ -163,6 +136,36 @@ extern void warn_slowpath_null(const char *file, const int line);unlikely (__ret_warn_once); \ }) +#else /* !CONFIG_BUG */ +#ifndef HAVE_ARCH_BUG +#define BUG () do {} while(0) +#endif + +#ifndef HAVE_ARCH_BUG_ON +#define BUG_ON (condition) do { if (condition) ; } while(0) +#endif + +#ifndef HAVE_ARCH_WARN_ON +#define WARN_ON (condition) ({ \ + int __ret_warn_on = !!(condition); \ + unlikely(__ret_warn_on); \ +}) +#endif + +#ifndef WARN +#define WARN(condition, format...) ({ \ + int __ret_warn_on = !!(condition); \ + unlikely(__ret_warn_on); \ +}) +#endif + +#define WARN_ON_ONCE (condition) WARN_ON(condition) +#define WARN_ONCE(condition, format...) WARN(condition, format) +#define WARN_TAINT(condition, taint, format...) WARN(condition, format) +#define WARN_TAINT_ONCE(condition, taint, format...) WARN(condition, format) + +#endif +/* * WARN_ON_SMP() is for cases that the warning is either * meaningless for !SMP or may even cause failures.
Signature · 1 line
1.9.0
PATCH v2 2/5 include/asm-generic/bug.h: Style fix: s/while(0)/while (0)/
--- include/asm-generic/bug.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/asm-generic/bug.h +3 -3
@@ -52,7 +52,7 @@ struct bug_entry {#endif #ifndef HAVE_ARCH_BUG_ON -#define BUG_ON (condition) do { if (unlikely(condition)) BUG(); } while(0) +#define BUG_ON (condition) do { if (unlikely(condition)) BUG(); } while (0)#endif /*
@@ -138,11 +138,11 @@ extern void warn_slowpath_null(const char *file, const int line);#else /* !CONFIG_BUG */ #ifndef HAVE_ARCH_BUG -#define BUG () do {} while(0) +#define BUG () do {} while (0)#endif #ifndef HAVE_ARCH_BUG_ON -#define BUG_ON (condition) do { if (condition) ; } while(0) +#define BUG_ON (condition) do { if (condition) ; } while (0)#endif #ifndef HAVE_ARCH_WARN_ON
Signature · 1 line
1.9.0
Re: [PATCH v2 2/5] include/asm-generic/bug.h: Style fix: s/while(0)/while (0)/
Quoted 3 lines · Josh Triplett
Reported-by Randy Dunlap <[email protected]>Signed-off-by Josh Triplett <[email protected]>
PATCH v2 3/5 bug: When !CONFIG_BUG, make WARN call no_printk to check format and args
In reply to Josh TriplettThe stub version of WARN for !CONFIG_BUG completely ignored its format string and subsequent arguments; make it check them instead, using no_printk.
--- include/asm-generic/bug.h | 1 + 1 file changed, 1 insertion(+)
include/asm-generic/bug.h +1 -0
@@ -155,6 +155,7 @@ extern void warn_slowpath_null(const char *file, const int line);#ifndef WARN #define WARN(condition, format...) ({ \ int __ret_warn_on = !!(condition); \ + no_printk(format); \ unlikely(__ret_warn_on); \ })#endif
Signature · 1 line
1.9.0
Re: [PATCH v2 3/5] bug: When !CONFIG_BUG, make WARN call no_printk to check format and args
Quoted 6 lines · Josh Triplett
The stub version of WARN for !CONFIG_BUG completely ignored its format string and subsequent arguments; make it check them instead, using
no_printk.Reported-by Arnd Bergmann <[email protected]>Signed-off-by Josh Triplett <[email protected]>
PATCH v2 4/5 bug: Use a common definition of BUG_ON regardless of CONFIG_BUG
In reply to Josh Triplettinclude/asm-generic/bug.h defines BUG_ON to call BUG() if CONFIG_BUG=y, or as a no-op if !CONFIG_BUG. However, BUG() is already a no-op if !CONFIG_BUG, making this pointless. Use a common definition that always calls BUG().
This does not change the compiled code at all.
--- include/asm-generic/bug.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
include/asm-generic/bug.h +4 -8
@@ -51,10 +51,6 @@ struct bug_entry { } while (0)#endif -#ifndef HAVE_ARCH_BUG_ON -#define BUG_ON (condition) do { if (unlikely(condition)) BUG(); } while (0) -#endif -/* * WARN(), WARN_ON(), WARN_ON_ONCE, and so on can be used to report * significant issues that need prompt attention if they should ever
@@ -141,10 +137,6 @@ extern void warn_slowpath_null(const char *file, const int line);#define BUG () do {} while (0)#endif -#ifndef HAVE_ARCH_BUG_ON -#define BUG_ON (condition) do { if (condition) ; } while (0) -#endif -#ifndef HAVE_ARCH_WARN_ON #define WARN_ON (condition) ({ \ int __ret_warn_on = !!(condition); \
@@ -167,6 +159,10 @@ extern void warn_slowpath_null(const char *file, const int line);#endif +#ifndef HAVE_ARCH_BUG_ON +#define BUG_ON (condition) do { if (unlikely(condition)) BUG(); } while (0) +#endif +/* * WARN_ON_SMP() is for cases that the warning is either * meaningless for !SMP or may even cause failures.
Signature · 1 line
1.9.0
Re: [PATCH v2 4/5] bug: Use a common definition of BUG_ON regardless of CONFIG_BUG
Quoted 9 lines · Josh Triplett
include/asm-generic/bug.hdefinesBUG_ONto callBUG()ifCONFIG_BUG=y, or as a no-op if !CONFIG_BUG. However,BUG()is already a no-op if !CONFIG_BUG, making this pointless. Use a common definition that always callsBUG().This does not change the compiled code at all.
Signed-off-by Josh Triplett <[email protected]>
PATCH v2 5/5 bug: Make BUG() call unreachable()
In reply to Josh TriplettThis effectively causes BUG() to act like a function with the noreturn attribute, which prevents GCC from warning about the code that follows BUG() (for instance, warning about not returning a value in a non-void function after calling BUG()).
This actually makes the kernel smaller; bloat-o-meter summary:
add/remove: 2/7 grow/shrink: 34/57 up/down: 475/-1233 (-758)
--- include/asm-generic/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-generic/bug.h +1 -1
@@ -134,7 +134,7 @@ extern void warn_slowpath_null(const char *file, const int line);#else /* !CONFIG_BUG */ #ifndef HAVE_ARCH_BUG -#define BUG () do {} while (0) +#define BUG () do { unreachable(); } while (0)#endif #ifndef HAVE_ARCH_WARN_ON
Signature · 1 line
1.9.0
Arnd Bergmann
maintainerRe: [PATCH v2 5/5] bug: Make BUG() call unreachable()
include/asm-generic/bug.h extern void warn_slowpath_null(const char *file, const int line); · line 138
Quoted 7 lines · Josh Triplett
include/asm-generic/bug.h +1
-1@@ -134,7 +134,7 @@ extern void warn_slowpath_null(const char *file, const int line);#else /* !CONFIG_BUG */ #ifndef HAVE_ARCH_BUG -#define BUG () do {} while (0) +#define BUG () do { unreachable(); } while (0)#endif
I disagree with this one. As Alan said, we really want to use an arch specific BUG() even in the !CONFIG_BUG case.
For the cases where this is not yet possible, I'd suggest using
#define BUG() do { } while (1)
For older gcc versions, this is actually the same as unreachable(), but it is not the same as __builtin_unreachable, because it causes undefined behavior.
Arnd
Re: [PATCH v2 5/5] bug: Make BUG() call unreachable()
Quoted 11 lines · Arnd Bergmann
include/asm-generic/bug.h extern void warn_slowpath_null(const char *file, const int line); · line 138
Quoted 7 lines · Josh Triplett
include/asm-generic/bug.h +1
-1@@ -134,7 +134,7 @@ extern void warn_slowpath_null(const char *file, const int line);#else /* !CONFIG_BUG */ #ifndef HAVE_ARCH_BUG -#define BUG () do {} while (0) +#define BUG () do { unreachable(); } while (0)#endif I disagree with this one. As Alan said, we really want to use an arch specific
BUG()even in the !CONFIG_BUG case.
Possibly, but when doing so on an arch-by-arch basis, we'd need to make sure that either there's a sensible trap handler for whatever trap it invokes (for instance, ud2), or that there's some kind of useful behavior otherwise (for instance, a reboot). Hence why I didn't make any attempt to add architecture-specific patches in this series.
In any case, I tried a quick test of that on x86 below, along with the generic equivalent.
Quoted 3 lines
For the cases where this is not yet possible, I'd suggest using
#define
BUG()do { } while (1)
I just tested this, and:
$ scripts/bloat-o-meter vmlinux-nobug-base vmlinux-nobug-loop add/remove: 2/1 grow/shrink: 247/33 up/down: 5461/-604 (4857)
In particular:
$ scripts/bloat-o-meter vmlinux-nobug-unreachable vmlinux-nobug-loop add/remove: 6/0 grow/shrink: 261/9 up/down: 5679/-64 (5615)
So, some functions do get the optimizations from GCC treating the code after an infinite loop as unreachable, but overall the infinite loops themselves (and the conditionals around them in the more common case of BUG_ON) are non-trivially large.
I tried a quick hack that used:
#define BUG() do { asm("ud2"); unreachable(); } while (0) in place of the infinite loop, and got:
$ scripts/bloat-o-meter vmlinux-nobug-base vmlinux-nobug-ud2-unreachable add/remove: 2/1 grow/shrink: 250/37 up/down: 4874/-606 (4268)
So, very little savings there compared to the infinite loop (unsurprising, since ud2 is two bytes, and so is "1: jmp 1b").
This doesn't seem any different than compiling out assert() at runtime in a userspace program, given how the kernel uses BUG() and BUG_ON(). I'd argue that adding unreachable() doesn't seem like it makes the current implementation of BUG() any worse; either way if you reach it you have a problem.
- Josh Triplett
Arnd Bergmann
maintainerRe: [PATCH v2 5/5] bug: Make BUG() call unreachable()
Quoted 5 lines · Josh Triplett
This doesn't seem any different than compiling out
assert()at runtime in a userspace program, given how the kernel usesBUG()andBUG_ON(). I'd argue that addingunreachable()doesn't seem like it makes the current implementation ofBUG()any worse; either way if you reach it you have a problem.
I think it's better to get a warning about undefined behavior than to suppress that warning.
Arnd
Re: [PATCH v2 5/5] bug: Make BUG() call unreachable()
Quoted 9 lines · Arnd Bergmann
Quoted 5 lines · Josh Triplett
This doesn't seem any different than compiling out
assert()at runtime in a userspace program, given how the kernel usesBUG()andBUG_ON(). I'd argue that addingunreachable()doesn't seem like it makes the current implementation ofBUG()any worse; either way if you reach it you have a problem.I think it's better to get a warning about undefined behavior than to suppress that warning.
Then at this point I'm going to suggest that you go ahead and submit the patch you want on top of the first four patches of this series. Please keep in mind the value and code size savings of !CONFIG_BUG, versus CONFIG_BUG=y and !CONFIG_DEBUG_BUGVERBOSE; those mean two different things.
Meanwhile: Andrew, could you go ahead and apply the first four patches?
- Josh Triplett
Arnd Bergmann
maintainerRe: [PATCH v2 5/5] bug: Make BUG() call unreachable()
Quoted 8 lines · On Thursday 27 February 2014 16:16:45 Josh Triplett wrote:
Quoted 7 lines · Arnd Bergmann
Quoted 5 lines · Josh Triplett
This doesn't seem any different than compiling out
assert()at runtime in a userspace program, given how the kernel usesBUG()andBUG_ON(). I'd argue that addingunreachable()doesn't seem like it makes the current implementation ofBUG()any worse; either way if you reach it you have a problem.
Quoted 5 lines
Quoted 2 lines
I think it's better to get a warning about undefined behavior than to suppress that warning.
Then at this point I'm going to suggest that you go ahead and submit the patch you want on top of the first four patches of this series.
Sure, no problem. I'll wait for your patches to show up in linux-next and then do a patch on top. I'll be traveling for the next week, so it may get delayed another few days.
Quoted 3 lines
Please keep in mind the value and code size savings of !CONFIG_BUG, versus
CONFIG_BUG=yand !CONFIG_DEBUG_BUGVERBOSE; those mean two different things.
I think I compared all the options before in the patch I cited,
https://lkml.org/lkml/2013/7/5/222 but I agree that the list is a bit confusing.
Quoted 1 line
Meanwhile: Andrew, could you go ahead and apply the first four patches?
Yes please.
Arnd
PATCH v3 1/5 bug: When !CONFIG_BUG, simplify WARN_ON_ONCE and family
When !CONFIG_BUG, WARN_ON and family become simple passthroughs of their condition argument; however, WARN_ON_ONCE and family still have conditions and a boolean to detect one-time invocation, even though the warning they'd emit doesn't exist. Make the existing definitions conditional on CONFIG_BUG, and add definitions for !CONFIG_BUG that map to the passthrough versions of WARN and WARN_ON.
This saves 4.4k on a minimized configuration (smaller than allnoconfig), and 20.6k with defconfig plus CONFIG_BUG=n.
---
v3: Patch unchanged from v2.
Andrew, can you please replace the entire v2 series currently in -mm with this new series?
include/asm-generic/bug.h | 57 +++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 27 deletions(-)
include/asm-generic/bug.h +30 -27
@@ -106,33 +106,6 @@ extern void warn_slowpath_null(const char *file, const int line);unlikely (__ret_warn_on); \ }) -#else /* !CONFIG_BUG */ -#ifndef HAVE_ARCH_BUG -#define BUG () do {} while(0) -#endif - -#ifndef HAVE_ARCH_BUG_ON -#define BUG_ON (condition) do { if (condition) ; } while(0) -#endif - -#ifndef HAVE_ARCH_WARN_ON -#define WARN_ON (condition) ({ \ - int __ret_warn_on = !!(condition); \ - unlikely(__ret_warn_on); \ -}) -#endif - -#ifndef WARN -#define WARN(condition, format...) ({ \ - int __ret_warn_on = !!(condition); \ - unlikely(__ret_warn_on); \ -}) -#endif - -#define WARN_TAINT(condition, taint, format...) WARN_ON(condition) - -#endif -#define WARN_ON_ONCE (condition) ({ \ static bool __section(.data.unlikely) __warned; \ int __ret_warn_once = !!(condition); \
@@ -163,6 +136,36 @@ extern void warn_slowpath_null(const char *file, const int line);unlikely (__ret_warn_once); \ }) +#else /* !CONFIG_BUG */ +#ifndef HAVE_ARCH_BUG +#define BUG () do {} while(0) +#endif + +#ifndef HAVE_ARCH_BUG_ON +#define BUG_ON (condition) do { if (condition) ; } while(0) +#endif + +#ifndef HAVE_ARCH_WARN_ON +#define WARN_ON (condition) ({ \ + int __ret_warn_on = !!(condition); \ + unlikely(__ret_warn_on); \ +}) +#endif + +#ifndef WARN +#define WARN(condition, format...) ({ \ + int __ret_warn_on = !!(condition); \ + unlikely(__ret_warn_on); \ +}) +#endif + +#define WARN_ON_ONCE (condition) WARN_ON(condition) +#define WARN_ONCE(condition, format...) WARN(condition, format) +#define WARN_TAINT(condition, taint, format...) WARN(condition, format) +#define WARN_TAINT_ONCE(condition, taint, format...) WARN(condition, format) + +#endif +/* * WARN_ON_SMP() is for cases that the warning is either * meaningless for !SMP or may even cause failures.
Signature · 1 line
1.9.0
PATCH v3 2/5 include/asm-generic/bug.h: Style fix: s/while(0)/while (0)/
---
v3: Patch unchanged from v2.
include/asm-generic/bug.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/asm-generic/bug.h +3 -3
@@ -52,7 +52,7 @@ struct bug_entry {#endif #ifndef HAVE_ARCH_BUG_ON -#define BUG_ON (condition) do { if (unlikely(condition)) BUG(); } while(0) +#define BUG_ON (condition) do { if (unlikely(condition)) BUG(); } while (0)#endif /*
@@ -138,11 +138,11 @@ extern void warn_slowpath_null(const char *file, const int line);#else /* !CONFIG_BUG */ #ifndef HAVE_ARCH_BUG -#define BUG () do {} while(0) +#define BUG () do {} while (0)#endif #ifndef HAVE_ARCH_BUG_ON -#define BUG_ON (condition) do { if (condition) ; } while(0) +#define BUG_ON (condition) do { if (condition) ; } while (0)#endif #ifndef HAVE_ARCH_WARN_ON
Signature · 1 line
1.9.0
PATCH v3 3/5 bug: When !CONFIG_BUG, make WARN call no_printk to check format and args
In reply to Josh TriplettThe stub version of WARN for !CONFIG_BUG completely ignored its format string and subsequent arguments; make it check them instead, using no_printk.
---
v3: Patch unchanged from v2.
include/asm-generic/bug.h | 1 + 1 file changed, 1 insertion(+)
include/asm-generic/bug.h +1 -0
@@ -155,6 +155,7 @@ extern void warn_slowpath_null(const char *file, const int line);#ifndef WARN #define WARN(condition, format...) ({ \ int __ret_warn_on = !!(condition); \ + no_printk(format); \ unlikely(__ret_warn_on); \ })#endif
Signature · 1 line
1.9.0
PATCH v3 4/5 bug: Make BUG() always stop the machine
In reply to Josh TriplettWhen !CONFIG_BUG and !HAVE_ARCH_BUG, define the generic BUG() as an infinite loop rather than a no-op. This avoids undefined behavior if execution ever actually reaches BUG(), and avoids warnings about code after BUG() (such as on non-void functions calling BUG() and then not returning).
bloat-o-meter results:
add/remove: 0/0 grow/shrink: 43/10 up/down: 235/-98 (137)
function old new delta umount_collect 119 138 +19 notify_change 306 324 +18 xstate_enable_boot_cpu 252 269 +17 kunmap 54 70 +16 balloon_page_dequeue 112 126 +14 mm_take_all_locks 223 233 +10 list_lru_walk_node 143 152 +9 vma_adjust 1059 1067 +8 pcpu_setup_first_chunk 1130 1138 +8 mm_drop_all_locks 143 151 +8 ns_capable 55 62 +7 anon_transport_class_unregister 8 15 +7 srcu_init_notifier_head 35 41 +6 shrink_dcache_for_umount 174 180 +6 kunmap_high 99 105 +6 end_page_writeback 43 49 +6 do_exit 1339 1345 +6 __kfifo_dma_out_prepare_r 86 92 +6 __kfifo_dma_in_prepare_r 90 96 +6 fixup_user_fault 120 125 +5 repair_env_string 73 77 +4 read_cache_pages_invalidate_page 56 60 +4 isolate_lru_pages.isra 142 146 +4 do_notify_parent_cldstop 255 259 +4 cpu_init 370 374 +4 utimes_common 270 272 +2 tasklet_hi_action 91 93 +2 tasklet_action 91 93 +2 set_pte_vaddr 46 48 +2 find_get_pages_tag 202 204 +2 early_iounmap 185 187 +2 __native_set_fixmap 36 38 +2 __get_user_pages 822 824 +2 __early_ioremap 299 301 +2 yield_task_stop 1 2 +1 tick_resume 37 38 +1 switched_to_stop 1 2 +1 switched_to_idle 1 2 +1 prio_changed_stop 1 2 +1 prio_changed_idle 1 2 +1 pm_qos_power_read 111 112 +1 arch_cpu_idle_dead 1 2 +1 __insert_vmap_area 140 141 +1 sys_renameat 614 612 -2 mm_fault_error 297 295 -2 SyS_renameat 614 612 -2 sys_linkat 416 413 -3 SyS_linkat 416 413 -3 chmod_common 129 122 -7 proc_cap_handler 240 225 -15 __schedule 849 831 -18 sys_madvise 1077 1054 -23 SyS_madvise 1077 1054 -23
---
v3: New patch in this series, incorporating Arnd's suggestion to make BUG() always stop execution. This eliminates the new warnings currently appearing in allnoconfig due to !CONFIG_BUG; unlike v2, this avoids using unreachable(), and thus avoids the possibility of undefined behvior if execution actually reaches a call to BUG().
include/asm-generic/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-generic/bug.h +1 -1
@@ -138,7 +138,7 @@ extern void warn_slowpath_null(const char *file, const int line);#else /* !CONFIG_BUG */ #ifndef HAVE_ARCH_BUG -#define BUG () do {} while (0) +#define BUG () do {} while (1)#endif #ifndef HAVE_ARCH_BUG_ON
Signature · 1 line
1.9.0
PATCH v3 5/5 x86: Always define BUG() and HAVE_ARCH_BUG, even with !CONFIG_BUG
In reply to Josh TriplettThis ensures that BUG() always has a definition that causes a trap (via an undefined instruction), and that the compiler still recognizes the code following BUG() as unreachable, avoiding warnings that would otherwise appear (such as on non-void functions that don't return a value after BUG()).
In addition to saving a few bytes over the generic infinite-loop implementation, this implementation traps rather than looping, which potentially allows for better error-recovery behavior (such as by rebooting).
---
v3: New patch for x86-optimized implementation of a simple bug for !CONFIG_BUG, based on Arnd Bergmann's proposal.
arch/x86/include/asm/bug.h | 3 --- 1 file changed, 3 deletions(-)
arch/x86/include/asm/bug.h +0 -3
@@ -1,7 +1,6 @@#ifndef _ASM_X86_BUG_H#define _ASM_X86_BUG_H -#ifdef CONFIG_BUG #define HAVE_ARCH_BUG #ifdef CONFIG_DEBUG_BUGVERBOSE
@@ -33,8 +32,6 @@ do { \ } while (0)#endif -#endif /* !CONFIG_BUG */ -#include <asm-generic/bug.h> #endif /* _ASM_X86_BUG_H */
Signature · 1 line
1.9.0
Quoted 11 lines · Josh Triplett
When !CONFIG_BUG,
WARN_ONand family become simple passthroughs of their condition argument; however,WARN_ON_ONCEand family still have conditions and a boolean to detect one-time invocation, even though the warning they'd emit doesn't exist. Make the existing definitions conditional onCONFIG_BUG, and add definitions for !CONFIG_BUG that map to the passthrough versions of WARN andWARN_ON.This saves 4.4k on a minimized configuration (smaller than allnoconfig), and 20.6k with defconfig plus
CONFIG_BUG=n.
Quoted 6 lines
Signed-off-by Josh Triplett <[email protected]>---
v3: Patch unchanged from v2.Andrew, can you please replace the entire v2 series currently in -mm with this new series?
Quoted 16 lines · Arnd Bergmann
Quoted 15 lines · Josh Triplett
When !CONFIG_BUG,
WARN_ONand family become simple passthroughs of their condition argument; however,WARN_ON_ONCEand family still have conditions and a boolean to detect one-time invocation, even though the warning they'd emit doesn't exist. Make the existing definitions conditional onCONFIG_BUG, and add definitions for !CONFIG_BUG that map to the passthrough versions of WARN andWARN_ON.This saves 4.4k on a minimized configuration (smaller than allnoconfig), and 20.6k with defconfig plus
CONFIG_BUG=n.Signed-off-by Josh Triplett <[email protected]>---
v3: Patch unchanged from v2.
Quoted 6 lines
Quoted 2 lines
Andrew, can you please replace the entire v2 series currently in -mm with this new series?
[all patches]Acked-by Arnd Bergmann <[email protected]>
Thanks!
- Josh Triplett
Quoted 11 lines · Josh Triplett
When !CONFIG_BUG,
WARN_ONand family become simple passthroughs of their condition argument; however,WARN_ON_ONCEand family still have conditions and a boolean to detect one-time invocation, even though the warning they'd emit doesn't exist. Make the existing definitions conditional onCONFIG_BUG, and add definitions for !CONFIG_BUG that map to the passthrough versions of WARN andWARN_ON.This saves 4.4k on a minimized configuration (smaller than allnoconfig), and 20.6k with defconfig plus
CONFIG_BUG=n.Signed-off-by Josh Triplett <[email protected]>