Re: [PATCH 2/2] tracing: Keep pid and comm[] in the same structure
From: David Laight
Date: Wed Jul 01 2026 - 12:58:36 EST
On Wed, 1 Jul 2026 08:23:40 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> On Wed, 1 Jul 2026 13:04:04 +0100
> David Laight <david.laight.linux@xxxxxxxxx> wrote:
>
>
> > > Well, that would break trace-cmd. As reading the raw buffers clears the
> > > trace, and trace-cmd reads the saved_cmdlines file *after* it reads the
> > > trace, as during the trace it gets populated.
> >
> > So you'd need to clear it when tracing is enabled after the buffer is cleared.
> > Just a matter of getting the timing right.
>
> Why? Note, saved_cmdlines is for *all* instances. You can have multiple
> instances tracing different things and they still all use the one
> saved_cmdlines file. It's not tied to any specific buffer. It's a cache. It
> gets populated at the next schedule switch after an event occurs.
>
Mostly thoughts about the size of the cache and the difference between the
apparent default size of 128 and the actual size of 6300.
I had said that I'd not really looked at when it was used, just what
it contained.
None of that is relevant to this patch which just changes the data structures
a bit.
It also means that most updates will only dirty a single cache line.
Indeed it is probably worth comparing the comm[] strings and only doing
the write it they differ to avoid dirtying the cache line(s).
David