* [PATCH v2] printk: increase the ring buffer for more than 16 CPUs by default
@ 2026-09-27 9:17 Sang-Heon Jeon
2026-09-27 16:09 ` John Ogness
0 siblings, 1 reply; 2+ messages in thread
From: Sang-Heon Jeon @ 2026-09-27 9:17 UTC (permalink / raw)
To: Petr Mladek; +Cc: John Ogness, linux-kernel, Sergey Senozhatsky, Steven Rostedt
The default LOG_BUF_SHIFT is 17, which means 128 KB, and
LOG_CPU_MAX_BUF_SHIFT is 12, which means 4 KB per CPU.
By default the ring buffer is increased when
(num_possible_cpus() - 1) * 4 KB > 64 KB, which requires more than 17
CPUs.
Remove the explicit subtraction of one, so the ring buffer is increased
for more than 16 CPUs, which is a power of two. Also fix the outdated
comment.
Suggested-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
Changes from v1 [1]
- Adjust default threshold to power of two, as suggested by Petr
[1] https://lore.kernel.org/all/20260921163828.111061-1-ekffu200098@gmail.com/
---
kernel/printk/printk.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 00f8e1291564..1ba440c1193e 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1085,9 +1085,9 @@ static void __init log_buf_add_cpu(void)
if (num_possible_cpus() == 1)
return;
- cpu_extra = (num_possible_cpus() - 1) * __LOG_CPU_MAX_BUF_LEN;
+ cpu_extra = num_possible_cpus() * __LOG_CPU_MAX_BUF_LEN;
- /* by default this will only continue through for large > 64 CPUs */
+ /* by default this will only continue through for more than 16 CPUs */
if (cpu_extra <= __LOG_BUF_LEN / 2)
return;
base-commit: b03d22ec8186f3f6b40b95a5a678100cf80116cb
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] printk: increase the ring buffer for more than 16 CPUs by default
2026-09-27 9:17 [PATCH v2] printk: increase the ring buffer for more than 16 CPUs by default Sang-Heon Jeon
@ 2026-09-27 16:09 ` John Ogness
0 siblings, 0 replies; 2+ messages in thread
From: John Ogness @ 2026-09-27 16:09 UTC (permalink / raw)
To: Sang-Heon Jeon, Petr Mladek
Cc: linux-kernel, Sergey Senozhatsky, Steven Rostedt
On 2026-09-27, Sang-Heon Jeon <ekffu200098@gmail.com> wrote:
> The default LOG_BUF_SHIFT is 17, which means 128 KB, and
> LOG_CPU_MAX_BUF_SHIFT is 12, which means 4 KB per CPU.
>
> By default the ring buffer is increased when
> (num_possible_cpus() - 1) * 4 KB > 64 KB, which requires more than 17
> CPUs.
>
> Remove the explicit subtraction of one, so the ring buffer is increased
> for more than 16 CPUs, which is a power of two. Also fix the outdated
> comment.
>
> Suggested-by: Petr Mladek <pmladek@suse.com>
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Reviewed-by: John Ogness <john.ogness@linutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-27 16:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-27 9:17 [PATCH v2] printk: increase the ring buffer for more than 16 CPUs by default Sang-Heon Jeon
2026-09-27 16:09 ` John Ogness
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®