diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index f7fb2587df693a2f5261812d101917cc3d3450bb..61867dff5d5aa6dea4079d060514f1bd57a63630 100644 --- a/tools/perf/util/build-id.c +++ b/tools/perf/util/build-id.c @@ -59,12 +59,8 @@ static int perf_event__exit_del_thread(struct perf_tool *tool __maybe_unused, dump_printf("(%d:%d):(%d:%d)\n", event->fork.pid, event->fork.tid, event->fork.ppid, event->fork.ptid); - if (thread) { - rb_erase(&thread->rb_node, &machine->threads); - if (machine->last_match == thread) - thread__zput(machine->last_match); - thread__put(thread); - } + if (thread) + machine__remove_thread(machine, thread); return 0; } diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 9c380a2caa541c1a1816974618d8e645c9be9288..527e032e24f6e648e258b08b379e55fc6dcf8e5a 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -14,8 +14,6 @@ #include "unwind.h" #include "linux/hash.h" -static void machine__remove_thread(struct machine *machine, struct thread *th); - static void dsos__init(struct dsos *dsos) { INIT_LIST_HEAD(&dsos->head); @@ -1256,7 +1254,7 @@ int machine__process_mmap_event(struct machine *machine, union perf_event *event return 0; } -static void machine__remove_thread(struct machine *machine, struct thread *th) +void machine__remove_thread(struct machine *machine, struct thread *th) { if (machine->last_match == th) thread__zput(machine->last_match); diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h index e2faf3b47e7bf5be277758a5ff0a425336d1a19b..6d64cedb9d1e8f6fb255068b27761f6c52735b5e 100644 --- a/tools/perf/util/machine.h +++ b/tools/perf/util/machine.h @@ -120,6 +120,7 @@ int machine__init(struct machine *machine, const char *root_dir, pid_t pid); void machine__exit(struct machine *machine); void machine__delete_threads(struct machine *machine); void machine__delete(struct machine *machine); +void machine__remove_thread(struct machine *machine, struct thread *th); struct branch_info *sample__resolve_bstack(struct perf_sample *sample, struct addr_location *al);