[PATCH v3 31/40] mm/vma: introduce vma[_flags]_is_persistent()

Lorenzo Stoakes (ARM) ljs at kernel.org
Fri Oct 2 06:59:35 PDT 2026


On Fri, Oct 02, 2026 at 03:11:27PM +0200, David Hildenbrand (Arm) wrote:
> I'd be very happy if we could find a clear way to describe "this is what we call
> user memory: anon+pagecache", if that could come handy in such a context.

Rather than arguing about it, how about shifting things to 'what backs the
mapping' and something like:

/* big long kdoc... */
static inline bool vma_flags_is_mm_backed(const vma_flags_t *flags)
{
	/* hugetlb is a fixed mapping, but the mm owns it entirely. */
	if (vma_flags_is_hugetlb(flags))
		return true;

	/*
	 * Kernel-owned mappings are populated by their owner, and fixed mappings
	 * have a layout the mm cannot assume ordinary fault semantics over.
	 */
	if (vma_flags_is_kernel_owned(flags) ||
	    vma_flags_is_fixed_mapping(flags))
		return false;

	/* The mm has promised it may discard droppable memory at any time. */
	return !vma_flags_test_single_mask(flags, VMA_DROPPABLE);
}

?

--
Cheers, Lorenzo



More information about the kvm-riscv mailing list