Re: [PATCH v3] printk: allow increasing the ring buffer depending on the number of CPUs

From: Davidlohr Bueso
Date: Fri Jun 13 2014 - 17:28:44 EST


On Fri, 2014-06-13 at 13:44 -0700, Luis R. Rodriguez wrote:
> On Fri, Jun 13, 2014 at 1:36 PM, Davidlohr Bueso <davidlohr@xxxxxx> wrote:
> > On Fri, 2014-06-13 at 11:28 -0700, Luis R. Rodriguez wrote:
> >> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> >> index 7228258..3f3356b 100644
> >> --- a/kernel/printk/printk.c
> >> +++ b/kernel/printk/printk.c
> >> @@ -246,6 +246,7 @@ static u32 clear_idx;
> >> #define LOG_ALIGN __alignof__(struct printk_log)
> >> #endif
> >> #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
> >> +#define __LOG_CPU_MIN_BUF_LEN (1 << CONFIG_LOG_CPU_MIN_BUF_SHIFT)
> >> static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN);
> >> static char *log_buf = __log_buf;
> >> static u32 log_buf_len = __LOG_BUF_LEN;
> >> @@ -752,6 +753,17 @@ void __init setup_log_buf(int early)
> >> unsigned long flags;
> >> char *new_log_buf;
> >> int free;
> >> + int cpu_extra = (num_possible_cpus() - 1) * __LOG_CPU_MIN_BUF_LEN;
> >
> > I think you forgot to drop the - 1 here.
>
> Actually that was on purpose as I had noticed in your suggestion on
> the other thread to fix the minimum number of CPUs required for this
> patch to be > 64 rather than >= 64 (with the defaults of 18 for log
> shift, and 12 for min cpu log shift). Minor difference, but it was
> intentional. Even though we do require SMP now the -1 can take effect,
> and it seems safer for now to only require this for > 64 CPU
> configurations for the defaults set. I'm happy to remove that as well,
> but bumping the CPU configuration mark for this to > 64 might be
> better for starters unless we do know for sure we also need this for
> 64.

Ah, ok I had missed that. Makes sense now.

Thanks,
Davidlohr

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/