[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1449734015-9148-14-git-send-email-namhyung@kernel.org>
Date: Thu, 10 Dec 2015 16:53:32 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Jiri Olsa <jolsa@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
David Ahern <dsahern@...il.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Andi Kleen <andi@...stfloor.org>,
Stephane Eranian <eranian@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>
Subject: [PATCH/RFC 13/16] perf top: Protect the seen list using mutex
When perf didn't find a machine, it records its pid in the seen list.
With multi-thread enabled, it shoud be protected using a mutex.
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
tools/perf/builtin-top.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index a9b7461be4f0..5987986b5203 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -916,7 +916,9 @@ static void perf_event__process_sample(struct reader_arg *rarg,
if (!machine && perf_guest) {
static struct intlist *seen;
+ static pthread_mutex_t seen_lock = PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_lock(&seen_lock);
if (!seen)
seen = intlist__new(NULL);
@@ -925,6 +927,7 @@ static void perf_event__process_sample(struct reader_arg *rarg,
sample->pid);
intlist__add(seen, sample->pid);
}
+ pthread_mutex_unlock(&seen_lock);
return;
}
--
2.6.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists