2022-10-20 14:32:04

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] trace/ring_buffer: remove unused arguments

On Thu, 20 Oct 2022 22:06:51 +0800
Song Chen <[email protected]> wrote:

> As a argument, event has nothing to do with either
> ring_buffer_unlock_commit or rb_commit and cleaning
> it up has no side effect.

OK, so this is because of a389d86f7fd0 ("ring-buffer: Have nested events
still record running time stamp") which removed the usage of event in rb_commit():

static void rb_commit(struct ring_buffer_per_cpu *cpu_buffer,
struct ring_buffer_event *event)
{
local_inc(&cpu_buffer->entries);
- rb_update_write_stamp(cpu_buffer, event);
rb_end_commit(cpu_buffer);
}


I guess this doesn't hurt.

-- Steve

>
> Signed-off-by: Song Chen <[email protected]>
> ---
> include/linux/ring_buffer.h | 3 +--
> kernel/trace/ring_buffer.c | 12 +++++-------
> kernel/trace/ring_buffer_benchmark.c | 2 +-
> kernel/trace/trace.c | 2 +-
> 4 files changed, 8 insertions(+), 11 deletions(-)


2022-10-20 16:23:22

by Song Chen

[permalink] [raw]
Subject: Re: [PATCH] trace/ring_buffer: remove unused arguments

Hi,

On 2022/10/20 下午10:15, Steven Rostedt wrote:
> On Thu, 20 Oct 2022 22:06:51 +0800
> Song Chen <[email protected]> wrote:
>
>> As a argument, event has nothing to do with either
>> ring_buffer_unlock_commit or rb_commit and cleaning
>> it up has no side effect.
>
> OK, so this is because of a389d86f7fd0 ("ring-buffer: Have nested events
> still record running time stamp") which removed the usage of event in rb_commit():
>
> static void rb_commit(struct ring_buffer_per_cpu *cpu_buffer,
> struct ring_buffer_event *event)
> {
> local_inc(&cpu_buffer->entries);
> - rb_update_write_stamp(cpu_buffer, event);
> rb_end_commit(cpu_buffer);
> }
>
>
> I guess this doesn't hurt.
>
> -- Steve
>

I was reading __kprobe_trace_func, store_trace_args stores args in
fbuffer.entry,which is event->array, but at the end, rb_commit uses
fbuffer.buffer instead of event.

Then i thought, if it's useless, why not just clean it up.

Song

>>
>> Signed-off-by: Song Chen <[email protected]>
>> ---
>> include/linux/ring_buffer.h | 3 +--
>> kernel/trace/ring_buffer.c | 12 +++++-------
>> kernel/trace/ring_buffer_benchmark.c | 2 +-
>> kernel/trace/trace.c | 2 +-
>> 4 files changed, 8 insertions(+), 11 deletions(-)
>

2022-10-20 16:25:02

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] trace/ring_buffer: remove unused arguments

On Thu, 20 Oct 2022 23:25:56 +0800
chensong <[email protected]> wrote:

> > I guess this doesn't hurt.
>
> I was reading __kprobe_trace_func, store_trace_args stores args in
> fbuffer.entry,which is event->array, but at the end, rb_commit uses
> fbuffer.buffer instead of event.
>
> Then i thought, if it's useless, why not just clean it up.


I meant your change probably doesn't hurt.

-- Steve