[PATCH 19/49] perf tools: Add thread::exited flag

From: Jiri Olsa
Date: Tue Jan 09 2018 - 10:44:52 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 1be0fa64e3ca..ab79c2797a3c 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1667,6 +1667,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 90bf1d01fcf3..5ca81f29afa8 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -27,7 +27,8 @@ struct thread {
char shortname[3];
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;
@@ -65,7 +66,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.13.6