Skip to content

Commit 5b95a50

Browse files
committed
Merge tag 'trace-v6.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull tracing fixes from Steven Rostedt: - Check for reader catching up in ring_buffer_map_get_reader() If the reader catches up to the writer in the memory mapped ring buffer then calling rb_get_reader_page() will return NULL as there's no pages left. But this isn't checked for before calling rb_get_reader_page() and the return of NULL causes a warning. If it is detected that the reader caught up to the writer, then simply exit the routine - Fix memory leak in histogram create_field_var() The couple of the error paths in create_field_var() did not properly clean up what was allocated. Make sure everything is freed properly on error - Fix help message of tools latency_collector The help message incorrectly stated that "-t" was the same as "--threads" whereas "--threads" is actually represented by "-e" * tag 'trace-v6.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: tracing/tools: Fix incorrcet short option in usage text for --threads tracing: Fix memory leaks in create_field_var() ring-buffer: Do not warn in ring_buffer_map_get_reader() when reader catches up
2 parents a80abfb + 53afec2 commit 5b95a50

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

kernel/trace/ring_buffer.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7344,6 +7344,10 @@ int ring_buffer_map_get_reader(struct trace_buffer *buffer, int cpu)
73447344
goto out;
73457345
}
73467346

7347+
/* Did the reader catch up with the writer? */
7348+
if (cpu_buffer->reader_page == cpu_buffer->commit_page)
7349+
goto out;
7350+
73477351
reader = rb_get_reader_page(cpu_buffer);
73487352
if (WARN_ON(!reader))
73497353
goto out;

kernel/trace/trace_events_hist.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3272,14 +3272,16 @@ static struct field_var *create_field_var(struct hist_trigger_data *hist_data,
32723272
var = create_var(hist_data, file, field_name, val->size, val->type);
32733273
if (IS_ERR(var)) {
32743274
hist_err(tr, HIST_ERR_VAR_CREATE_FIND_FAIL, errpos(field_name));
3275-
kfree(val);
3275+
destroy_hist_field(val, 0);
32763276
ret = PTR_ERR(var);
32773277
goto err;
32783278
}
32793279

32803280
field_var = kzalloc(sizeof(struct field_var), GFP_KERNEL);
32813281
if (!field_var) {
3282-
kfree(val);
3282+
destroy_hist_field(val, 0);
3283+
kfree_const(var->type);
3284+
kfree(var->var.name);
32833285
kfree(var);
32843286
ret = -ENOMEM;
32853287
goto err;

tools/tracing/latency/latency-collector.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ static void show_usage(void)
17251725
"-n, --notrace\t\tIf latency is detected, do not print out the content of\n"
17261726
"\t\t\tthe trace file to standard output\n\n"
17271727

1728-
"-t, --threads NRTHR\tRun NRTHR threads for printing. Default is %d.\n\n"
1728+
"-e, --threads NRTHR\tRun NRTHR threads for printing. Default is %d.\n\n"
17291729

17301730
"-r, --random\t\tArbitrarily sleep a certain amount of time, default\n"
17311731
"\t\t\t%ld ms, before reading the trace file. The\n"

0 commit comments

Comments
 (0)