[PATCH v2] printk: ringbuffer: Improve prb_next_seq() performance

Saravana Kannan saravanak at google.com
Thu Apr 7 17:36:16 PDT 2022


> --- a/kernel/printk/printk_ringbuffer.h
> +++ b/kernel/printk/printk_ringbuffer.h
> @@ -75,6 +75,7 @@ struct prb_desc_ring {
>  struct printk_info *infos;
>  atomic_long_t head_id;
>  atomic_long_t tail_id;
> + atomic_long_t last_finalized_id;

I really know nothing about this code, but while looking around
kernel/printk/ I noticed kernel/printk/printk.c has these lines in
log_buf_vmcoreinfo_setup().

        VMCOREINFO_STRUCT_SIZE(prb_desc_ring);
        VMCOREINFO_OFFSET(prb_desc_ring, count_bits);
        VMCOREINFO_OFFSET(prb_desc_ring, descs);
        VMCOREINFO_OFFSET(prb_desc_ring, infos);
        VMCOREINFO_OFFSET(prb_desc_ring, head_id);
        VMCOREINFO_OFFSET(prb_desc_ring, tail_id);

Would this header file change also require a change to that location?
Something like

        VMCOREINFO_OFFSET(prb_desc_ring, head_id);
        VMCOREINFO_OFFSET(prb_desc_ring, tail_id);
+        VMCOREINFO_OFFSET(prb_desc_ring, last_finalized_id);

-Saravana

> };
>
> /*
> @@ -258,6 +259,7 @@ static struct printk_ringbuffer name = { \
>  .infos = &_##name##_infos[0], \
>  .head_id = ATOMIC_INIT(DESC0_ID(descbits)), \
>  .tail_id = ATOMIC_INIT(DESC0_ID(descbits)), \
> + .last_finalized_id = ATOMIC_INIT(DESC0_ID(descbits)), \
>  }, \
>  .text_data_ring = { \
>  .size_bits = (avgtextbits) + (descbits), \



More information about the Linux-mediatek mailing list