Re: [PATCH v5 16/38] mm/vma: add and use vma_[flags]_is_fixed_mapping
flat view
From: "David Hildenbrand (Arm)" <david@kernel.org>
Date: 2026-10-12 18:11:43
Also in:
bpf, dri-devel, fuse-devel, kvm, kvm-riscv, kvmarm, linux-arch, linux-doc, linux-fbdev, linux-fsdevel, linux-mm, linux-perf-users, linux-rdma, linux-riscv, linux-s390, linux-scsi, linux-sound, linux-trace-kernel, linux-usb, lkml, selinux, sparclinux
On 10/9/26 20:04, Lorenzo Stoakes (ARM) wrote:
This determines whether a VMA cannot be expanded or merged because what
they mapped was determined to be a set size at mmap time.
This typically refers to mappings not managed by core mm, however
VMA_DONTEXPAND_BIT
is not reliably set alongside VMA_PFNMAP_BIT or VMA_MIXEDMAP_BIT, so we
must explicitly test for this for now.
We also explicitly test for VMA_PFNMAP_BIT as VMA_DONTEXPAND_BIT may not be
set for VMA_PFNMAP_BIT's despite the one implying the other.
Use this predicate in vma_flags_can_merge() and in check_prep_vma() in the
mremap logic testing to see if mremap() can expand the VMA. The criteria
for khugepaged and MADV_COLLAPSE eligibility in
__thp_vma_allowable_orders() are precisely those for mergeability, so use
vma_can_merge() there (with an expanded comment).
This obviates the need for the VM_NO_KHUGEPAGED mask, so remove it.
Hugetlb VMAs remain excluded from khugepaged as hugetlbfs always sets
VMA_DONTEXPAND_BIT.
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David