Skip to content

Commit ba361c9

Browse files
committed
perf tools: Don't stop synthesizing threads when one vanishes
The perf_event__synthesize_threads routine synthesizes all the existing threads in the system, because we don't have any kernel facilities to ask for PERF_RECORD_{FORK,MMAP,COMM} for existing threads. It was returning an error as soon as one thread couldn't be synthesized, which is a bit extreme when, for instance, a forkish workload is running, like a kernel compile. Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 6ca2a9c commit ba361c9

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tools/perf/util/event.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -405,16 +405,15 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
405405

406406
if (*end) /* only interested in proper numerical dirents */
407407
continue;
408-
409-
if (__event__synthesize_thread(comm_event, mmap_event, pid, 1,
410-
process, tool, machine) != 0) {
411-
err = -1;
412-
goto out_closedir;
413-
}
408+
/*
409+
* We may race with exiting thread, so don't stop just because
410+
* one thread couldn't be synthesized.
411+
*/
412+
__event__synthesize_thread(comm_event, mmap_event, pid, 1,
413+
process, tool, machine);
414414
}
415415

416416
err = 0;
417-
out_closedir:
418417
closedir(proc);
419418
out_free_mmap:
420419
free(mmap_event);

0 commit comments

Comments
 (0)