[PATCH v6 35/39] mm: eliminate VMA_SPECIAL_FLAGS check in lru_gen_look_around()

Lorenzo Stoakes (ARM) ljs at kernel.org
Tue Oct 13 08:05:15 PDT 2026


A fixed or non-mm-managed mapping is one which sets VMA_PFNMAP_BIT,
VMA_MIXEDMAP_BIT or VMA_DONTEXPAND_BIT, which is precisely what
VMA_SPECIAL_FLAGS tests for other than VMA_IO_BIT, which is safe to drop as
mm-managed mappings may not set it.

This is equivalent to testing for an mm-backed mapping, except for hugetlb.

However, hugetlb folios are never placed on the LRU and
lru_gen_look_around() is only called from LRU shrinkers on reclaim so this
is fine.

Using vma_is_mm_backed() rather than checking VMA_SPECIAL_FLAGS makes the
check self-documenting and helps eliminate confusion around 'special
flags'.

No functional change intended.

Reviewed-by: Zi Yan <ziy at nvidia.com>
Acked-by: David Hildenbrand (Arm) <david at kernel.org>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs at kernel.org>
---
 mm/vmscan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index aecb157bc379..178a5de6c439 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4417,8 +4417,8 @@ bool lru_gen_look_around(struct page_vma_mapped_walk *pvmw, unsigned int nr)
 	if (spin_is_contended(pvmw->ptl))
 		return true;
 
-	/* exclude special VMAs containing anon pages from COW */
-	if (vma->vm_flags & VM_SPECIAL)
+	/* exclude non-mm-backed VMAs containing anon pages from COW */
+	if (!vma_is_mm_backed(vma))
 		return true;
 
 	/* avoid taking the LRU lock under the PTL when possible */

-- 
2.55.0




More information about the kvm-riscv mailing list