[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1469623926-16458-1-git-send-email-tomoki.sekiyama.qu@hitachi.com>
Date: Wed, 27 Jul 2016 21:52:06 +0900
From: Tomoki Sekiyama <tomoki.sekiyama.qu@...achi.com>
To: linux-kernel@...r.kernel.org
Cc: ltc-kernel@...ml.intra.hitachi.co.jp,
Tomoki Sekiyama <tomoki.sekiyama.qu@...achi.com>,
Jiri Olsa <jolsa@...nel.org>, David Ahern <dsahern@...il.com>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Masami Hiramatsu <mhiramat@...nel.org>
Subject: [PATCH] perf sched: fix wrong conversion of task state
sched_out_state() converts the prev_state u64 bitmask to a char in
a wrong way, which may cause wrong results of 'perf sched latency'.
This patch fixes the conversion.
Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama.qu@...achi.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: David Ahern <dsahern@...il.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Masami Hiramatsu <mhiramat@...nel.org>
---
tools/perf/builtin-sched.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 0dfe8df..eb2f7f4 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -71,6 +71,7 @@ struct sched_atom {
};
#define TASK_STATE_TO_CHAR_STR "RSDTtZXxKWP"
+#define TASK_STATE_MASK 0x7ff
enum thread_state {
THREAD_SLEEPING = 0,
@@ -899,7 +900,7 @@ static char sched_out_state(u64 prev_state)
{
const char *str = TASK_STATE_TO_CHAR_STR;
- return str[prev_state];
+ return str[ffs(prev_state & TASK_STATE_MASK)];
}
static int
--
2.7.4
Powered by blists - more mailing lists