Skip to content

Commit 320bf43

Browse files
ycongal-smilepmladek
authored andcommitted
printk: Fix LOG_CPU_MAX_BUF_SHIFT when BASE_SMALL is enabled
LOG_CPU_MAX_BUF_SHIFT default value depends on BASE_SMALL: config LOG_CPU_MAX_BUF_SHIFT default 12 if !BASE_SMALL default 0 if BASE_SMALL But, BASE_SMALL is a config of type int and "!BASE_SMALL" is always evaluated to true whatever is the value of BASE_SMALL. This patch fixes this by using the correct conditional operator for int type : BASE_SMALL != 0. Note: This changes CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 to CONFIG_LOG_CPU_MAX_BUF_SHIFT=0 for BASE_SMALL defconfigs, but that will not be a big impact due to this code in kernel/printk/printk.c: /* by default this will only continue through for large > 64 CPUs */ if (cpu_extra <= __LOG_BUF_LEN / 2) return; Systems using CONFIG_BASE_SMALL and having 64+ CPUs should be quite rare. John Ogness <[email protected]> (printk reviewer) wrote: > For printk this will mean that BASE_SMALL systems were probably > previously allocating/using the dynamic ringbuffer and now they will > just continue to use the static ringbuffer. Which is fine and saves > memory (as it should). Petr Mladek <[email protected]> (printk maintainer) wrote: > More precisely, it allocated the buffer dynamically when the sum > of per-CPU-extra space exceeded half of the default static ring > buffer. This happened for systems with more than 64 CPUs with > the default config values. Reported-by: Geert Uytterhoeven <[email protected]> Closes: https://lore.kernel.org/all/CAMuHMdWm6u1wX7efZQf=2XUAHascps76YQac6rdnQGhc8nop_Q@mail.gmail.com/ Reported-by: Vegard Nossum <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Fixes: 4e244c1 ("kconfig: remove unneeded symbol_empty variable") Reviewed-by: Petr Mladek <[email protected]> Reviewed-by: Masahiro Yamada <[email protected]> Signed-off-by: Yoann Congal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Mladek <[email protected]>
1 parent b054677 commit 320bf43

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

init/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,8 @@ config LOG_CPU_MAX_BUF_SHIFT
743743
int "CPU kernel log buffer size contribution (13 => 8 KB, 17 => 128KB)"
744744
depends on SMP
745745
range 0 21
746-
default 12 if !BASE_SMALL
747-
default 0 if BASE_SMALL
746+
default 0 if BASE_SMALL != 0
747+
default 12
748748
depends on PRINTK
749749
help
750750
This option allows to increase the default ring buffer size

0 commit comments

Comments
 (0)