Re: buffer allocation: was: [PATCH v3 3/3] printk: use the lockless ringbuffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-06-29, Petr Mladek <pmladek@xxxxxxxx> wrote:
>> @@ @@ void __init setup_log_buf(int early)
>> +	prb_init(&printk_rb_dynamic,
>> +		 new_log_buf, order_base_2(new_log_buf_len),
>> +		 new_dict_buf, order_base_2(new_log_buf_len),
>> +		 new_descs, order_base_2(new_descs_count));
>
> order_base_2() is safe. But the result might be tat some allocated
> space is not used.
>
> I would prefer to make sure that new_log_buf_len is rounded, e.g.
> by roundup_pow_of_two(), at the beginning of the function. Then we
> could use ilog2() here.

new_log_buf_len can only be set within log_buf_len_update(), and it
is already doing exactly what you want:

        if (size)
                size = roundup_pow_of_two(size);
        if (size > log_buf_len)
                new_log_buf_len = (unsigned long)size;

I can switch to ilog2() instead of the more conservative order_base_2().

John Ogness

_______________________________________________
kexec mailing list
kexec@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux