Thread (44 messages) 44 messages, 5 authors, 20h ago

Re: [PATCH 11/13] mm/mlock: convert mlock code to use vma_flags_t

From: Lance Yang <lance.yang@linux.dev>
Date: 2026-07-02 13:21:54
Also in: dri-devel, intel-gfx, intel-xe, linux-arm-msm, linux-fbdev, linux-fsdevel, linux-mips, linux-samsung-soc, linux-sound, linux-tegra, lkml, nouveau, virtualization, xen-devel

On Mon, Jun 29, 2026 at 08:25:34PM +0100, Lorenzo Stoakes wrote:
Replace use of the legacy vm_flags_t flags with vma_flags_t values
throughout the mlock logic.

Additionally update comments to reflect the changes to be consistent.

No functional change intended.

Signed-off-by: Lorenzo Stoakes <ljs@kernel.org>
---
Nothing scary jumped out at me. Just one tiny nit below ;)

[...]
quoted hunk ↗ jump to hunk
@@ -466,24 +466,23 @@ static void mlock_vma_pages_range(struct vm_area_struct *vma,
 */
static int mlock_fixup(struct vma_iterator *vmi, struct vm_area_struct *vma,
	       struct vm_area_struct **prev, unsigned long start,
-	       unsigned long end, vm_flags_t newflags)
+	       unsigned long end, vma_flags_t *new_vma_flags)
{
-	vma_flags_t new_vma_flags = legacy_to_vma_flags(newflags);
	const vma_flags_t old_vma_flags = vma->flags;
	struct mm_struct *mm = vma->vm_mm;
	int nr_pages;
	int ret = 0;

-	if (vma_flags_same_pair(&old_vma_flags, &new_vma_flags) ||
+	if (vma_flags_same_pair(&old_vma_flags, new_vma_flags) ||
	    vma_is_secretmem(vma) || !vma_supports_mlock(vma)) {
		/*
-		 * Don't set VM_LOCKED or VM_LOCKONFAULT and don't count.
+		 * Don't set VMA_LOCKED_BIT or VM_LOCKONFAULT and don't count.
s/VM_LOCKONFAULT/VMA_LOCKONFAULT_BIT/

Otherwise LGTM. Feel free to add:

Reviewed-by: Lance Yang <lance.yang@linux.dev>
		 * For secretmem, don't allow the memory to be unlocked.
		 */
		goto out;
	}

-	vma = vma_modify_flags(vmi, *prev, vma, start, end, &new_vma_flags);
+	vma = vma_modify_flags(vmi, *prev, vma, start, end, new_vma_flags);
	if (IS_ERR(vma)) {
		ret = PTR_ERR(vma);
		goto out;
[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help