[PATCH 19/48] perf tools: Add thread::exited flag
From: Jiri Olsa
Date: Thu Sep 13 2018 - 08:58:32 EST
Adding thread::exited to indicate the thread has exited,
and keeping the thread::dead flag to indicate thread
is on the dead list.
Link: http://lkml.kernel.org/n/tip-iak1784r9z2vhcnw6getmbdk@xxxxxxxxxxxxxx
Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
tools/perf/util/machine.c | 3 +++
tools/perf/util/thread.h | 5 +++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 999f200f24e7..5ae2baba27ca 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1828,6 +1828,9 @@ static void __machine__remove_thread(struct machine *machine, struct thread *th,
rb_erase_init(&th->rb_node, &threads->entries);
RB_CLEAR_NODE(&th->rb_node);
--threads->nr;
+
+ th->dead = true;
+
/*
* No need to have an additional reference for non-index file
* as they can be released when reference holders died and
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index e8f779e83347..8a1114c2f43a 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -26,7 +26,8 @@ struct thread {
refcount_t refcnt;
bool comm_set;
int comm_len;
- bool dead; /* if set thread has exited */
+ bool exited; /* if set thread has exited */
+ bool dead; /* if set thread is in dead tree */
struct list_head namespaces_list;
struct rw_semaphore namespaces_lock;
struct list_head comm_list;
@@ -64,7 +65,7 @@ static inline void __thread__zput(struct thread **thread)
static inline void thread__exited(struct thread *thread)
{
- thread->dead = true;
+ thread->exited = true;
}
struct namespaces *thread__namespaces(const struct thread *thread);
--
2.17.1