linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Jakub Acs <acsjakub@amazon.de>
Cc: <aliceryhl@google.com>, <djwong@kernel.org>,
	<jhubbard@nvidia.com>, <akpm@linux-foundation.org>,
	<axelrasmussen@google.com>, <chengming.zhou@linux.dev>,
	<david@redhat.com>, <linux-fsdevel@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
	<peterx@redhat.com>, <rust-for-linux@vger.kernel.org>,
	<xu.xin16@zte.com.cn>
Subject: Re: [PATCH] mm: use enum for vm_flags
Date: Wed, 8 Oct 2025 10:17:20 -0400	[thread overview]
Message-ID: <20251008101720.6c68c5cd@gandalf.local.home> (raw)
In-Reply-To: <20251008125427.68735-1-acsjakub@amazon.de>

On Wed, 8 Oct 2025 12:54:27 +0000
Jakub Acs <acsjakub@amazon.de> wrote:


> Hi Alice,
> 
> thanks for the patch, I squashed it in (should I add your signed-off-by
> too?) and added the TRACE_DEFINE_ENUM calls pointed out by Derrick.
> 
> I have the following points to still address, though: 
> 
> - can the fact that we're not controlling the type of the values if
>   using enum be a problem? (likely the indirect control we have through
>   the highest value is good enough, but I'm not sure)
> 
> - where do TRACE_DEFINE_ENUM calls belong?

It's probably best to put them in include/trace/events/mmflags.h

>   I see them placed e.g. in include/trace/misc/nfs.h for nfs or
>   arch/x86/kvm/mmu/mmutrace.h, but I don't see a corresponding file for
>   mm.h - does this warrant creating a separate file for these
>   definitions?
> 
> - with the need for TRACE_DEFINE_ENUM calls, do we still deem this
>   to be a good trade-off? - isn't fixing all of these in
>   rust/bindings/bindings_helper.h better?

There's tricks to add a bunch of TRACE_DEFINE_ENUM()s at once. In fact,
look at how the macro TRACE_GFP_FLAGS_GENERAL is used in that mmflags.h
file.

The reason macros work but enums do not is because the pre-processor
converts macros to their original values but not enums. The TRACE_EVENT()
converts the "printf" part into a string. The macros are changes to their
values, but enums do not get changed.

The TRACE_DEFINE_ENUM() macro adds magic to map the name of the enum to its
value, and on boot up, the printf formats have the enums convert to the
values. Note, I'm working on having this performed at build time.

-- Steve

  parent reply	other threads:[~2025-10-08 14:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-02  7:52 [PATCH v4] mm: redefine VM_* flag constants with BIT() Jakub Acs
2025-10-02  7:54 ` David Hildenbrand
2025-10-02 17:43 ` SeongJae Park
2025-10-07 16:21 ` [PATCH] mm: use enum for vm_flags Alice Ryhl
2025-10-07 17:01   ` Darrick J. Wong
2025-10-08  2:36   ` John Hubbard
2025-10-08 12:54   ` Jakub Acs
2025-10-08 13:15     ` Alice Ryhl
2025-10-10 15:10       ` Darrick J. Wong
2025-10-08 14:17     ` Steven Rostedt [this message]
2025-10-09  2:33     ` John Hubbard
2025-10-11  0:18     ` kernel test robot
2025-10-11  0:39     ` kernel test robot
2025-10-10 16:13   ` kernel test robot
2025-10-11  0:50   ` kernel test robot

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=20251008101720.6c68c5cd@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=acsjakub@amazon.de \
    --cc=akpm@linux-foundation.org \
    --cc=aliceryhl@google.com \
    --cc=axelrasmussen@google.com \
    --cc=chengming.zhou@linux.dev \
    --cc=david@redhat.com \
    --cc=djwong@kernel.org \
    --cc=jhubbard@nvidia.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=peterx@redhat.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=xu.xin16@zte.com.cn \
    /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).