Re: [RFC RFC PATCH] mm: convert VM flags from macros to enum
From: Ye Liu
Date: Tue Oct 14 2025 - 04:27:08 EST
在 2025/10/13 21:19, Lorenzo Stoakes 写道:
> On Mon, Oct 13, 2025 at 03:07:18PM +0200, Vlastimil Babka wrote:
>> On 10/13/25 14:57, Lorenzo Stoakes wrote:
>>> FOLL_* flags are an anonymous enum, enum fault_flag is not used as a type
>>> anywhere, nor is vm_fault_reason. So those are both kinda weird as to why we
>>> even name the type (they're in effect anonymous).
>>>
>>> But also 'we do X in the kernel' doesn't mean doing X is right :)
>>
>> I think the example to follow could be GFP flags. Nowadays there's an enum
>> below it, and a layer that adds (__force gfp_t), so you could do similar
>> thing with vm_flags_t.
>>
>> However I'm not sure how compatible is that with Lorenzo's plans.
>
> That's defining bit values in an anonymous enum so isn't really comparable.
>
> But what it's doing, ultimately, in broad terms (other than the opaque bitmap
> type I'll be using for VMA flags) is what my changes will do.
>
> And yeah, trying to do duplicate that is not really a good use of time and will
> conflict with my work.
>
> Overall I think this change is generally unnecessary given that I'm about to
> radically alter how VMA flags are implemented, and actually will cause me
> problems.
>
> But as I said before, I'm happy to prioritise the change that specifies the
> flags based on the bit numbers, I actually have it ready more-or-less.
>
Thanks for the input, everyone.
Lorenzo, I agree with your assessment.
I'll pause on this from my side and wait for your patch.
I'm excited to see the new implementation.
> Cheers, Lorenzo
--
Thanks,
Ye Liu