[PATCH v2 0/2] tracing: Clean up how iter is freed

Steven Rostedt
2023-07-15T14:13:56Z

The trace iterator is used in various interfaces and needs to be consistent
in how it is cleaned up. Add a helper function to clean up its content. But
before doing so, I noticed that iter->trace is allocated then the content
of tr->current_trace is copied to it. There's no reason for this, so the
first patch removes that allocation and just points to the content of
tr->current_trace, as tr->current_trace can change, but the content should
not.

Changes since v1: https://lore.kernel.org/linux-trace-kernel/20230713114510.04c452ca@gandalf.local.home/

- Updated the change log of patch 1, as I remembered why the copy was done.

- Remove the allocation and copy of the second patch. I started with the
second patch and noticed that there was an inconsistency with the
iter->trace. Where in one place it was allocated and copied and the second
place it was just pointing to the tr->current_trace. I first started to make it
be a copy as well, but then realized that the copy wasn't needed. I created
the first patch but forgot to remove the copy and it ended up in the second
patch.

Steven Rostedt (Google) (2):
tracing: Remove unnecessary copying of tr->current_trace
tracing: Add free_trace_iter_content() helper function

----
kernel/trace/trace.c | 55 ++++++++++++++++++++++++----------------------------
1 file changed, 25 insertions(+), 30 deletions(-)