Re: [PATCH] ring-buffer: Preserve true payload lengths in long data events

From: Steven Rostedt

Date: Tue Apr 07 2026 - 11:57:32 EST


On Tue, 7 Apr 2026 17:15:50 +0800
Cao Ruichuang <create0818@xxxxxxx> wrote:

> Long ring buffer data records currently store the aligned in-buffer size in
> their length field. That makes ring_buffer_event_length() report padded
> sizes, and small TRACE_PRINT / TRACE_RAW_DATA records lose their true
> payload length entirely when they use the short type_len encoding.
>
> Teach long data events to keep the true payload size in array[0], and let
> the ring buffer derive the aligned in-buffer size separately when it needs
> to walk or discard records. Then add a long-reserve helper and use it for
> TRACE_PRINT and TRACE_RAW_DATA so their zero-length-array tails always
> preserve the real payload size.

Sorry, I'm against this change. I made a conscious decision to have the
ring buffer meta data record the size allocated and not the size requested.

If an event needs to know the actual size, then it needs to add that
information itself. That's not the job of the ring buffer code.

NAK.

-- Steve