diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2024-02-28 15:00:02 +0100 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2024-03-19 16:11:42 +0100 |
commit | 8522f6b760ca588928eede740d5d69dd1e936b49 (patch) | |
tree | 2ab6495c7f841a06dd5e855d37062f586f35abf4 /include/linux/printk.h | |
parent | b0546776ad3f332e215cebc0b063ba4351971cca (diff) | |
download | linux-stable-8522f6b760ca588928eede740d5d69dd1e936b49.tar.gz linux-stable-8522f6b760ca588928eede740d5d69dd1e936b49.tar.bz2 linux-stable-8522f6b760ca588928eede740d5d69dd1e936b49.zip |
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: 337015573718b161 ("printk: Userspace format indexing support")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Chris Down <chris@chrisdown.name>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/56cf92edccffea970e1f40a075334dd6cf5bb2a4.1709127473.git.geert+renesas@glider.be
Signed-off-by: Petr Mladek <pmladek@suse.com>
Diffstat (limited to 'include/linux/printk.h')
-rw-r--r-- | include/linux/printk.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/printk.h b/include/linux/printk.h index 955e31860095..2fde40cc9677 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -126,7 +126,7 @@ struct va_format { #define no_printk(fmt, ...) \ ({ \ if (0) \ - printk(fmt, ##__VA_ARGS__); \ + _printk(fmt, ##__VA_ARGS__); \ 0; \ }) |