Re: [PATCH -mm 4/5] tools/perf: replace hard-coded 16 with TASK_COMM_LEN

From
Yafang Shao <hidden>
Date
2021-12-09 02:42:53
Also in
linux-fsdevel, linux-mm, linux-perf-users, lkml
Reply to
Steven Rostedt, 2021-12-08
On Thu, Dec 9, 2021 at 2:43 AM Steven Rostedt [off-list ref] wrote:
On Sat,  4 Dec 2021 09:52:55 +0000
Yafang Shao [off-list ref] wrote:
quoted
@@ -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, 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, 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, false))
Shouldn't all these be TASK_COMM_LEN_16?
The value here must be the same with TASK_COMM_LEN, so I use TASK_COMM_LEN here.
But we may also change the code as
https://lore.kernel.org/lkml/20211101060419.4682-9-laoar.shao@gmail.com/ (local)
if TASK_COMM_LEN is changed, so TASK_COMM_LEN_16 is also okay here.
I will change it to TASK_COMM_LEN_16 in the next version.
quoted
              ret = -1;

      if (evsel__test_field(evsel, "pid", 4, true))

-- 
Thanks
Yafang
Thread (15 messages) 15 messages, 3 authors, last reply 2021-12-09
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help