On Tue, 2024-02-13 at 11:52 -0500, Steven Rostedt wrote: > From: "Steven Rostedt (Google)" <rost...@goodmis.org> > > The saved_cmdlines have three arrays for mapping PIDs to COMMs: > > - map_pid_to_cmdline[] > - map_cmdline_to_pid[] > - saved_cmdlines > > The map_pid_to_cmdline[] is PID_MAX_DEFAULT in size and holds the index > into the other arrays. The map_cmdline_to_pid[] is a mapping back to the > full pid as it can be larger than PID_MAX_DEFAULT. And the > saved_cmdlines[] just holds the COMMs associated to the pids. > > Currently the map_pid_to_cmdline[] and saved_cmdlines[] are allocated > together (in reality the saved_cmdlines is just in the memory of the > rounding of the allocation of the structure as it is always allocated in > powers of two). The map_cmdline_to_pid[] array is allocated separately. > > Since the rounding to a power of two is rather large (it allows for 8000 > elements in saved_cmdlines), also include the map_cmdline_to_pid[] array. > (This drops it to 6000 by default, which is still plenty for most use > cases). This saves even more memory as the map_cmdline_to_pid[] array > doesn't need to be allocated. > > Link: > https://lore.kernel.org/linux-trace-kernel/20240212174011.06821...@gandalf.local.home/ > > Signed-off-by: Steven Rostedt (Google) <rost...@goodmis.org>
Patch looks good to me. Reviewd-by: Tim Chen <tim.c.c...@linux.intel.com> > --- > Changes since v1: > https://lore.kernel.org/linux-trace-kernel/20240212180941.379c4...@gandalf.local.home/ > > -- Added SAVED_CMDLINE_MAP_ELEMENT_SIZE helper macro. >