All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 10/15] tools/lib/perf: use TASK_COMM_LEN_16 instead of hard-coded 16
@ 2021-10-21  3:45 Yafang Shao
  2021-10-21  3:45 ` [PATCH v5 11/15] tools/bpf/bpftool: " Yafang Shao
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Yafang Shao @ 2021-10-21  3:45 UTC (permalink / raw)
  To: keescook, rostedt, mathieu.desnoyers, arnaldo.melo, pmladek,
	peterz, viro, akpm, valentin.schneider, qiang.zhang, robdclark,
	christian, dietmar.eggemann, mingo, juri.lelli, vincent.guittot,
	davem, kuba, ast, daniel, andrii, kafai, songliubraving, yhs,
	john.fastabend, kpsingh
  Cc: netdev, bpf, linux-perf-users, linux-fsdevel, linux-kernel,
	oliver.sang, lkp, Yafang Shao

Use TASK_COMM_LEN_16 instead of hard-coded 16 to make it more grepable.
The comm is set in perf_event__prepare_comm(), which makes the comm
always a nul terminated string, so we don't worry about whether it will
be truncated or not.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Petr Mladek <pmladek@suse.com>
---
 tools/lib/perf/include/perf/event.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/lib/perf/include/perf/event.h b/tools/lib/perf/include/perf/event.h
index 4d0c02ba3f7d..ab22b4e570c6 100644
--- a/tools/lib/perf/include/perf/event.h
+++ b/tools/lib/perf/include/perf/event.h
@@ -6,6 +6,7 @@
 #include <linux/types.h>
 #include <linux/limits.h>
 #include <linux/bpf.h>
+#include <linux/sched/task.h>
 #include <sys/types.h> /* pid_t */
 
 #define event_contains(obj, mem) ((obj).header.size > offsetof(typeof(obj), mem))
@@ -47,7 +48,7 @@ struct perf_record_mmap2 {
 struct perf_record_comm {
 	struct perf_event_header header;
 	__u32			 pid, tid;
-	char			 comm[16];
+	char			 comm[TASK_COMM_LEN_16];
 };
 
 struct perf_record_namespaces {
@@ -291,7 +292,7 @@ struct perf_record_itrace_start {
 
 struct perf_record_thread_map_entry {
 	__u64			 pid;
-	char			 comm[16];
+	char			 comm[TASK_COMM_LEN_16];
 };
 
 struct perf_record_thread_map {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-10-22 23:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21  3:45 [PATCH v5 10/15] tools/lib/perf: use TASK_COMM_LEN_16 instead of hard-coded 16 Yafang Shao
2021-10-21  3:45 ` [PATCH v5 11/15] tools/bpf/bpftool: " Yafang Shao
2021-10-21 22:38   ` Andrii Nakryiko
2021-10-21  3:46 ` [PATCH v5 12/15] tools/perf/test: make perf test adopt to task comm size change Yafang Shao
2021-10-21  3:46 ` [PATCH v5 13/15] tools/testing/selftests/bpf: use TASK_COMM_LEN_16 instead of hard-coded 16 Yafang Shao
2021-10-21 22:44   ` Andrii Nakryiko
2021-10-22  6:36     ` Yafang Shao
2021-10-22 23:41       ` Andrii Nakryiko
2021-10-21  3:46 ` [PATCH v5 14/15] sched.h: extend task comm from 16 to 24 for CONFIG_BASE_FULL Yafang Shao
2021-10-21  3:46 ` [PATCH v5 15/15] kernel/kthread: show a warning if kthread's comm is truncated Yafang Shao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.