Re: [PATCH] mm: Convert memory block states (MEM_*) macros to enum
David Hildenbrand <[email protected]> Tue, 28 Oct 2025 17:06:17 +0100
| Newsgroups | org.kernel.vger.linux-debuggers,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
> I read > https://lore.kernel.org/all/[email protected]/ > ("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