[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211211063949.49533-4-laoar.shao@gmail.com>
Date: Sat, 11 Dec 2021 06:39:49 +0000
From: Yafang Shao <laoar.shao@...il.com>
To: akpm@...ux-foundation.org, rostedt@...dmis.org,
keescook@...omium.org, pmladek@...e.com, david@...hat.com,
arnaldo.melo@...il.com, andrii.nakryiko@...il.com,
alexei.starovoitov@...il.com
Cc: linux-mm@...ck.org, bpf@...r.kernel.org,
linux-perf-users@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, Yafang Shao <laoar.shao@...il.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Michal Miroslaw <mirq-linux@...e.qmqm.pl>,
Peter Zijlstra <peterz@...radead.org>,
Matthew Wilcox <willy@...radead.org>,
Al Viro <viro@...iv.linux.org.uk>
Subject: [PATCH -mm v2 3/3] tools/perf: replace old hard-coded 16 with TASK_COMM_LEN_16
evsel-tp-sched will verify the task comm len in sched:sched_switch
and sched:sched_wakeup tracepoints. In order to make it grepable, we'd
better replace the hard-coded 16 with TASK_COMM_LEN_16.
Signed-off-by: Yafang Shao <laoar.shao@...il.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: Michal Miroslaw <mirq-linux@...e.qmqm.pl>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Matthew Wilcox <willy@...radead.org>
Cc: David Hildenbrand <david@...hat.com>
Cc: Al Viro <viro@...iv.linux.org.uk>
Cc: Kees Cook <keescook@...omium.org>
Cc: Petr Mladek <pmladek@...e.com>
---
tools/perf/tests/evsel-tp-sched.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/perf/tests/evsel-tp-sched.c b/tools/perf/tests/evsel-tp-sched.c
index cf4da3d748c2..8be44b8e2b9c 100644
--- a/tools/perf/tests/evsel-tp-sched.c
+++ b/tools/perf/tests/evsel-tp-sched.c
@@ -5,6 +5,8 @@
#include "tests.h"
#include "debug.h"
+#define TASK_COMM_LEN_16 16
+
static int evsel__test_field(struct evsel *evsel, const char *name, int size, bool should_be_signed)
{
struct tep_format_field *field = evsel__field(evsel, name);
@@ -43,7 +45,7 @@ static int test__perf_evsel__tp_sched_test(struct test_suite *test __maybe_unuse
return -1;
}
- if (evsel__test_field(evsel, "prev_comm", 16, false))
+ if (evsel__test_field(evsel, "prev_comm", TASK_COMM_LEN_16, false))
ret = -1;
if (evsel__test_field(evsel, "prev_pid", 4, true))
@@ -55,7 +57,7 @@ static int test__perf_evsel__tp_sched_test(struct test_suite *test __maybe_unuse
if (evsel__test_field(evsel, "prev_state", sizeof(long), true))
ret = -1;
- if (evsel__test_field(evsel, "next_comm", 16, false))
+ if (evsel__test_field(evsel, "next_comm", TASK_COMM_LEN_16, false))
ret = -1;
if (evsel__test_field(evsel, "next_pid", 4, true))
@@ -73,7 +75,7 @@ static int test__perf_evsel__tp_sched_test(struct test_suite *test __maybe_unuse
return -1;
}
- if (evsel__test_field(evsel, "comm", 16, false))
+ if (evsel__test_field(evsel, "comm", TASK_COMM_LEN_16, false))
ret = -1;
if (evsel__test_field(evsel, "pid", 4, true))
--
2.17.1
Powered by blists - more mailing lists