From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>,
linux-mm@kvack.org, linux-perf-users@vger.kernel.org,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Michael Petlan <mpetlan@redhat.com>,
Veronika Molnarova <vmolnaro@redhat.com>,
Suren Baghdasaryan <surenb@google.com>
Subject: Re: [PATCH] tracing: gfp: Fix the GFP enum values shown for user space tracing tools
Date: Thu, 16 Jan 2025 14:18:00 -0500 [thread overview]
Message-ID: <20250116141800.31d519eb@gandalf.local.home> (raw)
In-Reply-To: <CAHk-=wiFEeyY5HE3NMvDYd254yHynzaQyzwYhv5gzRj7KU+gjA@mail.gmail.com>
On Thu, 16 Jan 2025 11:00:20 -0800
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Thu, 16 Jan 2025 at 10:23, Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > --- a/include/linux/gfp_types.h
> > +++ b/include/linux/gfp_types.h
>
> No - please do these somewhere else.
>
> This header is included by *everything*.
>
> Put it in some tracing header that isn't.
>
But they are only defines, they are not created until used. Are you worried
that it will slow down the compile?
I wanted this to stay close to where they are crated so they can keep in
sync, and not break when something new is added.
Another way is to have something like:
diff --git a/include/linux/gfp_types.h b/include/linux/gfp_types.h
index 4591a3e1711d..65c61c7b9f22 100644
--- a/include/linux/gfp_types.h
+++ b/include/linux/gfp_types.h
@@ -23,41 +23,66 @@ typedef unsigned int __bitwise gfp_t;
* include/trace/events/mmflags.h and tools/perf/builtin-kmem.c
*/
-enum {
- ___GFP_DMA_BIT,
- ___GFP_HIGHMEM_BIT,
- ___GFP_DMA32_BIT,
- ___GFP_MOVABLE_BIT,
- ___GFP_RECLAIMABLE_BIT,
- ___GFP_HIGH_BIT,
- ___GFP_IO_BIT,
- ___GFP_FS_BIT,
- ___GFP_ZERO_BIT,
- ___GFP_UNUSED_BIT, /* 0x200u unused */
- ___GFP_DIRECT_RECLAIM_BIT,
- ___GFP_KSWAPD_RECLAIM_BIT,
- ___GFP_WRITE_BIT,
- ___GFP_NOWARN_BIT,
- ___GFP_RETRY_MAYFAIL_BIT,
- ___GFP_NOFAIL_BIT,
- ___GFP_NORETRY_BIT,
- ___GFP_MEMALLOC_BIT,
- ___GFP_COMP_BIT,
- ___GFP_NOMEMALLOC_BIT,
- ___GFP_HARDWALL_BIT,
- ___GFP_THISNODE_BIT,
- ___GFP_ACCOUNT_BIT,
- ___GFP_ZEROTAGS_BIT,
+#define GFP_BITS_GENERAL \
+ EM(DMA) \
+ EM(HIGHMEM) \
+ EM(DMA32) \
+ EM(MOVABLE) \
+ EM(RECLAIMABLE) \
+ EM(HIGH) \
+ EM(IO) \
+ EM(FS) \
+ EM(ZERO) \
+ EM(UNUSED_BIT) \
+ EM(DIRECT_RECLAIM) \
+ EM(KSWAPD_RECLAIM) \
+ EM(WRITE) \
+ EM(NOWARN) \
+ EM(RETRY_MAYFAIL) \
+ EM(NOFAIL) \
+ EM(NORETRY) \
+ EM(MEMALLOC) \
+ EM(COMP) \
+ EM(NOMEMALLOC) \
+ EM(HARDWALL) \
+ EM(THISNODE) \
+ EM(ACCOUNT) \
+ EM(ZEROTAGS)
+
#ifdef CONFIG_KASAN_HW_TAGS
- ___GFP_SKIP_ZERO_BIT,
- ___GFP_SKIP_KASAN_BIT,
+# define GFP_BITS_KASAN \
+ EM(SKIP_ZERO) \
+ EM(SKIP_KASAN)
+#else
+# define GFP_BITS_KASAN
#endif
+
#ifdef CONFIG_LOCKDEP
- ___GFP_NOLOCKDEP_BIT,
+# define GFP_BITS_LOCKDEP \
+ EM(NOLOCKDEP)
+#else
+# define GFP_BITS_LOCKDEP
#endif
+
#ifdef CONFIG_SLAB_OBJ_EXT
- ___GFP_NO_OBJ_EXT_BIT,
+# define GFP_BITS_SLAB \
+ EM(NO_OBJ_EXT)
+#else
+# define GFP_BITS_SLAB
#endif
+
+# define GFP_BITS \
+ GFP_BITS_GENERAL \
+ GFP_BITS_KASAN \
+ GFP_BITS_LOCKDEP \
+ GFP_BITS_SLAB
+
+
+#undef EM
+#define EM(a) ___GFP_##a##_BIT,
+
+enum {
+ GFP_BITS
___GFP_LAST_BIT
};
Then I could just use the GFP_BITS and redefine the EM() to add the
TRACE_DEFINE_ENUM() around them. Or something similar.
But I didn't think you would go for that.
-- Steve
next prev parent reply other threads:[~2025-01-16 19:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-16 18:23 Steven Rostedt
2025-01-16 18:53 ` Steven Rostedt
2025-01-16 19:00 ` Linus Torvalds
2025-01-16 19:18 ` Steven Rostedt [this message]
2025-01-16 19:19 ` Linus Torvalds
2025-01-16 19:30 ` Steven Rostedt
2025-01-16 19:30 ` Linus Torvalds
2025-01-16 20:12 ` Steven Rostedt
2025-01-16 19:43 ` Steven Rostedt
2025-01-16 19:49 ` Steven Rostedt
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=20250116141800.31d519eb@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=mpetlan@redhat.com \
--cc=surenb@google.com \
--cc=torvalds@linux-foundation.org \
--cc=vmolnaro@redhat.com \
/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