From: David Hildenbrand <david@redhat.com>
To: Omar Sandoval <osandov@osandov.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Israel Batista <linux@israelbatista.dev.br>,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-debuggers@vger.kernel.org
Subject: Re: [PATCH] mm: Convert memory block states (MEM_*) macros to enum
Date: Tue, 28 Oct 2025 17:06:17 +0100 [thread overview]
Message-ID: <b40b7eb6-4e15-475b-9a74-c3ca1560fd38@redhat.com> (raw)
In-Reply-To: <aQABhaMC8xfO2Vem@telecaster>
> I read
> https://lore.kernel.org/all/809f552d-3282-4746-ba49-066d2bd8d44f@lucifer.local/
> ("it's not valid to have flag values as an enum") as a claim that this
> was invalid at the language level, but it sounds like your objection is
> more of a personal style preference. Which is totally fine, the MM
> subsystem can have whatever rules it wants.
>
> To play devil's advocate, using a named enum for flags makes it easy to
> document what flags are used for a given field
A current best practice for flags is to use a __bitwise typedef. That
way, sparse will be able to make sure that people are not using other
random values.
We don't make use of that everywhere yet, of course. FOLL_ flags are
still wrapped in an enum, for example.
--
Cheers
David / dhildenb
next prev parent reply other threads:[~2025-10-28 16:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-26 16:22 Israel Batista
2025-10-27 9:29 ` David Hildenbrand
2025-10-27 18:15 ` Omar Sandoval
2025-10-27 19:16 ` David Hildenbrand
2025-10-27 19:46 ` Lorenzo Stoakes
2025-10-27 23:34 ` Omar Sandoval
2025-10-28 16:06 ` David Hildenbrand [this message]
2025-10-28 16:33 ` Lorenzo Stoakes
2025-10-28 17:40 ` Omar Sandoval
2025-10-27 23:53 ` Israel Batista
2025-10-28 16:34 ` Lorenzo Stoakes
2025-10-28 19:06 ` Israel Batista
2025-10-28 19:13 ` Lorenzo Stoakes
2025-10-27 18:18 ` Omar Sandoval
2025-10-27 19:17 ` David Hildenbrand
2025-10-27 23:41 ` Israel Batista
2025-10-28 6:51 ` Omar Sandoval
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=b40b7eb6-4e15-475b-9a74-c3ca1560fd38@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-debuggers@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@israelbatista.dev.br \
--cc=lorenzo.stoakes@oracle.com \
--cc=osandov@osandov.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