From ae30792e536c80aed87fb11ec9140e55ed99da09 Mon Sep 17 00:00:00 2001 From: Sang-Heon Jeon Date: Sun, 27 Sep 2026 18:17:54 +0900 Subject: [PATCH] printk: increase the ring buffer for more than 16 CPUs by default 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 Signed-off-by: Sang-Heon Jeon Reviewed-by: John Ogness Reviewed-by: Petr Mladek Link: https://patch.msgid.link/20260927091756.50831-1-ekffu200098@gmail.com Signed-off-by: Petr Mladek --- 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 a3c4ee6d9f1d..45c3cfc28e78 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;