Skip to content

Commit 8522f6b

Browse files
geertupmladek
authored andcommitted
printk: Let no_printk() use _printk()
When printk-indexing is enabled, each printk() invocation emits a pi_entry structure, containing the format string and other information related to its location in the kernel sources. This is even true for no_printk(): while the actual code to print the message is optimized out by the compiler due to the always-false check, the pi_entry structure is still emitted. As the main purpose of no_printk() is to provide a helper to maintain printf()-style format checking when debugging is disabled, this leads to the inclusion in the index of lots of printk formats that cannot be emitted by the current kernel. Fix this by switching no_printk() from printk() to _printk(). This reduces the size of an arm64 defconfig kernel with CONFIG_PRINTK_INDEX=y by 576 KiB. Fixes: 3370155 ("printk: Userspace format indexing support") Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Xiubo Li <[email protected]> Reviewed-by: Chris Down <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/56cf92edccffea970e1f40a075334dd6cf5bb2a4.1709127473.git.geert+renesas@glider.be Signed-off-by: Petr Mladek <[email protected]>
1 parent b054677 commit 8522f6b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/printk.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ struct va_format {
126126
#define no_printk(fmt, ...) \
127127
({ \
128128
if (0) \
129-
printk(fmt, ##__VA_ARGS__); \
129+
_printk(fmt, ##__VA_ARGS__); \
130130
0; \
131131
})
132132

0 commit comments

Comments
 (0)