From: Yafang Shao <laoar.shao@gmail.com>
To: akpm@linux-foundation.org, rostedt@goodmis.org,
keescook@chromium.org, pmladek@suse.com, david@redhat.com,
arnaldo.melo@gmail.com, andrii.nakryiko@gmail.com
Cc: linux-mm@kvack.org, bpf@vger.kernel.org,
linux-perf-users@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, Yafang Shao <laoar.shao@gmail.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Michal Miroslaw <mirq-linux@rere.qmqm.pl>,
Peter Zijlstra <peterz@infradead.org>,
Matthew Wilcox <willy@infradead.org>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH -mm 3/5] samples/bpf/tracex2: replace hard-coded 16 with TASK_COMM_LEN
Date: Sat, 4 Dec 2021 09:52:54 +0000 [thread overview]
Message-ID: <20211204095256.78042-4-laoar.shao@gmail.com> (raw)
In-Reply-To: <20211204095256.78042-1-laoar.shao@gmail.com>
The comm used in tracex2 should have the same size with the comm in
task_struct, we'd better define the size of it as TASK_COMM_LEN to make it
more grepable.
linux/sched.h can be included in tracex2 kernel code, but it can't be
included in tracex2 userspace code. So a new marco TASK_COMM_LEN is
defined in tracex2 userspace code.
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: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Michal Miroslaw <mirq-linux@rere.qmqm.pl>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Kees Cook <keescook@chromium.org>
Cc: Petr Mladek <pmladek@suse.com>
---
samples/bpf/tracex2_kern.c | 3 ++-
samples/bpf/tracex2_user.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/samples/bpf/tracex2_kern.c b/samples/bpf/tracex2_kern.c
index 5bc696bac27d..51dbaf765cd5 100644
--- a/samples/bpf/tracex2_kern.c
+++ b/samples/bpf/tracex2_kern.c
@@ -7,6 +7,7 @@
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/version.h>
+#include <linux/sched.h>
#include <uapi/linux/bpf.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
@@ -65,7 +66,7 @@ static unsigned int log2l(unsigned long v)
}
struct hist_key {
- char comm[16];
+ char comm[TASK_COMM_LEN];
u64 pid_tgid;
u64 uid_gid;
u64 index;
diff --git a/samples/bpf/tracex2_user.c b/samples/bpf/tracex2_user.c
index 1626d51dfffd..b728a946d83d 100644
--- a/samples/bpf/tracex2_user.c
+++ b/samples/bpf/tracex2_user.c
@@ -12,6 +12,7 @@
#define MAX_INDEX 64
#define MAX_STARS 38
+#define TASK_COMM_LEN 16
/* my_map, my_hist_map */
static int map_fd[2];
@@ -28,7 +29,7 @@ static void stars(char *str, long val, long max, int width)
}
struct task {
- char comm[16];
+ char comm[TASK_COMM_LEN];
__u64 pid_tgid;
__u64 uid_gid;
};
--
2.17.1
next prev parent reply other threads:[~2021-12-04 9:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-04 9:52 [PATCH -mm 0/5] Phase 2 of task comm cleanups Yafang Shao
2021-12-04 9:52 ` [PATCH -mm 1/5] elfcore: replace old hard-code 16 with TASK_COMM_LEN_16 Yafang Shao
2021-12-08 18:39 ` Steven Rostedt
2021-12-04 9:52 ` [PATCH -mm 2/5] cn_proc: replaced old hard-coded " Yafang Shao
2021-12-08 18:40 ` Steven Rostedt
2021-12-04 9:52 ` Yafang Shao [this message]
2021-12-04 16:45 ` [PATCH -mm 3/5] samples/bpf/tracex2: replace hard-coded 16 with TASK_COMM_LEN Alexei Starovoitov
2021-12-04 9:52 ` [PATCH -mm 4/5] tools/perf: " Yafang Shao
2021-12-08 18:43 ` Steven Rostedt
2021-12-09 2:42 ` Yafang Shao
2021-12-04 9:52 ` [PATCH -mm 5/5] bpf/progs: " Yafang Shao
2021-12-04 16:44 ` Alexei Starovoitov
2021-12-05 2:44 ` Yafang Shao
2021-12-05 3:13 ` Alexei Starovoitov
2021-12-05 7:25 ` Yafang Shao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211204095256.78042-4-laoar.shao@gmail.com \
--to=laoar.shao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=arnaldo.melo@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=david@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mirq-linux@rere.qmqm.pl \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).