On Fri, Nov 06, 2026 at 11:57:08AM +0800, Barry Song wrote: > On Fri, Nov 6, 2026 at 5:32 AM Lorenzo Stoakes (ARM) <[email protected]> wrote: > > > > Replace the remaining uses of the legacy vm_flags_t flags in the rmap logic > > with vma_flags_t values. > > > > No functional change intended. > > > > Signed-off-by: Lorenzo Stoakes (ARM) <[email protected]> > > --- > > LGTM, > > Reviewed-by: Barry Song <[email protected]> > > > mm/rmap.c | 8 +++++--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/mm/rmap.c b/mm/rmap.c > > index 1131b76bbbc2..cdc97fec8586 100644 > > --- a/mm/rmap.c > > +++ b/mm/rmap.c > > @@ -1196,7 +1196,7 @@ static bool page_mkclean_one(struct folio *folio, > > struct vm_area_struct *vma, > > > > static bool invalid_mkclean_vma(struct vm_area_struct *vma, void *arg) > > { > > - if (vma->vm_flags & VM_SHARED) > > + if (vma_test(vma, VMA_SHARED_BIT)) > > return false; > > > > return true; > > @@ -1660,7 +1660,8 @@ void folio_add_new_anon_rmap(struct folio *folio, > > struct vm_area_struct *vma, > > * VM_DROPPABLE mappings don't swap; instead they're just dropped > > when > > * under memory pressure. > > */ > > - if (!folio_test_swapbacked(folio) && !(vma->vm_flags & > > VM_DROPPABLE)) > > + if (!folio_test_swapbacked(folio) && > > + !vma_test_single_mask(vma, VMA_DROPPABLE)) > > Right, VMA_DROPPABLE_BIT is not available on > 32-bit architectures, so vma_test() cannot be > used here.
Yeah, it's an annoying wrinkle having to differentiate, but is necessary. Eventually we will have 32-bit kernels move to the same size vma_flags_t as 64-bit, e.g. something like: - #define NUM_VMA_FLAG_BITS BITS_PER_LONG + #define NUM_VMA_FLAG_BITS 8 But that's down the road :) Which will solve the 'not in 32-bit-kernels' stuff. But also this form is also used for stuff that's not defined under certain configurations, in which case you get something like: #ifdef CONFIG_FOOBAR #define VMA_BLAH mk_vma_flags(VMA_BLAH_BIT) #else #define VMA_BLAH EMPTY_VMA_FLAGS #endif And then vma_test_single_mask() is necessary too. An unfortunate outcome of defining per-bit (so no bit value means 'nothing'), and any kind of invalid bit value solution has worse drawbacks. In the end all this stuff will be useful as it allows us to no longer be constrained by either 32-bit vs 64-bit or in only having 64 possible flags. :) -- Cheers, Lorenzo
