aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/machine.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2015-05-25 14:23:05 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-05-27 11:21:45 -0400
commit0170b14f5f5462524d05ee96275b7a0a0d34ae77 (patch)
tree973df99dee6be3910da08d15ec9e079d7b0e3ed9 /tools/perf/util/machine.c
parent9402e23f90c5a672db7170e4c0f1fc80ca8c009a (diff)
perf machine: Mark removed threads as such
We use: BUG_ON(!RB_EMPTY_NODE(&thread->rb_node)); in the thread destructor as a debugging check to find out about possibly still referenced thread instances being deleted, to do that we need to make sure we use RB_CLEAR_NODE() right after rb_erase(), i.e. that we use the newly introduced rb_erase_init(), that works just like list_del_init(). Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-4fcqo5ypy1cjjf15ilb0hn78@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/machine.c')
-rw-r--r--tools/perf/util/machine.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 7ec3188d3cb3..6bf845758ae3 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -400,7 +400,7 @@ static struct thread *____machine__findnew_thread(struct machine *machine,
400 * leader and that would screwed the rb tree. 400 * leader and that would screwed the rb tree.
401 */ 401 */
402 if (thread__init_map_groups(th, machine)) { 402 if (thread__init_map_groups(th, machine)) {
403 rb_erase(&th->rb_node, &machine->threads); 403 rb_erase_init(&th->rb_node, &machine->threads);
404 RB_CLEAR_NODE(&th->rb_node); 404 RB_CLEAR_NODE(&th->rb_node);
405 thread__delete(th); 405 thread__delete(th);
406 return NULL; 406 return NULL;
@@ -1314,7 +1314,7 @@ static void __machine__remove_thread(struct machine *machine, struct thread *th,
1314 BUG_ON(atomic_read(&th->refcnt) == 0); 1314 BUG_ON(atomic_read(&th->refcnt) == 0);
1315 if (lock) 1315 if (lock)
1316 pthread_rwlock_wrlock(&machine->threads_lock); 1316 pthread_rwlock_wrlock(&machine->threads_lock);
1317 rb_erase(&th->rb_node, &machine->threads); 1317 rb_erase_init(&th->rb_node, &machine->threads);
1318 RB_CLEAR_NODE(&th->rb_node); 1318 RB_CLEAR_NODE(&th->rb_node);
1319 /* 1319 /*
1320 * Move it first to the dead_threads list, then drop the reference, 1320 * Move it first to the dead_threads list, then drop the reference,