diff options
author | Steven Rostedt (Google) <rostedt@goodmis.org> | 2024-01-11 17:15:37 -0500 |
---|---|---|
committer | Steven Rostedt (Google) <rostedt@goodmis.org> | 2024-01-11 17:51:53 -0500 |
commit | b5fdb070a885249a43cfe4dff074a42b11aae374 (patch) | |
tree | 599eae89e8407829fd0e78cf6a79c3a9b2352e62 | |
parent | a49c838e91b10c41058bcd4d7dbcf9980a3c625d (diff) | |
download | trace-cmd-b5fdb070a885249a43cfe4dff074a42b11aae374.tar.gz |
libtracecmd: Do not free records at end of iterator
I'm not sure why the records that were saved in the "peek" were freed, as
they should be freed when the tracecmd_input is closed.
Remove the freeing of the "peek" records, as it should be unneeded.
This basically reverts:
890855541 ("tracecmd library: Unlock records in tracecmd_iterate_events()")
And commits that simulated it.
Link: https://lore.kernel.org/linux-trace-devel/20240111222201.154686-3-rostedt@goodmis.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r-- | lib/trace-cmd/trace-input.c | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c index b89167de..ecddaa21 100644 --- a/lib/trace-cmd/trace-input.c +++ b/lib/trace-cmd/trace-input.c @@ -2857,19 +2857,6 @@ int tracecmd_iterate_events(struct tracecmd_input *handle, } } while (next_cpu >= 0 && ret == 0); - /* Need to unlock and free the records */ - for (cpu = 0; cpu < handle->cpus; cpu++) { - int offset; - - if (!records[cpu]) - continue; - - offset = (int)(records[cpu]->offset & (handle->page_size - 1)); - free_next(handle, cpu); - /* Reset the buffer to read the cached record again */ - kbuffer_read_at_offset(handle->cpu_data[cpu].kbuf, offset, NULL); - } - free(records); return ret; @@ -2912,25 +2899,6 @@ load_records(struct tracecmd_input *handle, int cpu, return last_record; } -static void free_last_record(struct tracecmd_input *handle, struct tep_record *record, - int cpu) -{ - record->priv = handle->cpu_data[cpu].page; - tracecmd_free_record(record); -} - -static void free_last_records(struct tracecmd_input *handle, struct tep_record *records, - int cpu) -{ - struct tep_record *last_record; - - while (records) { - last_record = records; - records = last_record->priv; - free_last_record(handle, last_record, cpu); - } -} - static void initialize_last_events(struct tracecmd_input *handle, struct tep_record **last_records, cpu_set_t *cpu_set, int cpu_size, @@ -3065,20 +3033,6 @@ int tracecmd_iterate_events_reverse(struct tracecmd_input *handle, } } while (next_cpu >= 0 && ret == 0); - for (cpu = 0; cpu < max_cpus; cpu++) { - int offset; - - /* Get the next record to set the index to. */ - record = peek_last_event(handle, records, cpu); - if (!record) - continue; - /* Reset the buffer to read the cached record again */ - offset = record->offset & (handle->page_size - 1); - free_last_records(handle, records[cpu], cpu); - /* Reset the buffer to read the cached record again */ - kbuffer_read_at_offset(handle->cpu_data[cpu].kbuf, offset, NULL); - } - free(records); return ret; @@ -3167,23 +3121,6 @@ int tracecmd_iterate_events_multi(struct tracecmd_input **handles, } while (next_cpu >= 0 && ret == 0); - /* Unlock and free the records */ - for (cpu = 0; cpu < all_cpus; cpu++) { - int local_cpu; - int offset; - - if (!records[cpu].record) - continue; - - handle = records[cpu].handle; - local_cpu = cpu - handle->start_cpu; - - offset = (int)(records[cpu].record->offset & (handle->page_size - 1)); - free_next(handle, local_cpu); - /* Reset the buffer to read the cached record again */ - kbuffer_read_at_offset(handle->cpu_data[local_cpu].kbuf, offset, NULL); - } - free(records); return ret; |