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

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

From: Lorenzo Stoakes <ljs@kernel.org>
Date: 2026-07-02 15:47:40
Also in: dri-devel, intel-gfx, intel-xe, linux-arm-msm, linux-fbdev, linux-fsdevel, linux-mips, linux-mm, linux-samsung-soc, linux-sound, linux-tegra, lkml, nouveau, virtualization, xen-devel

On Thu, Jul 02, 2026 at 09:21:07PM +0800, Lance Yang wrote:
On Mon, Jun 29, 2026 at 08:25:34PM +0100, Lorenzo Stoakes wrote:
quoted
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
@@ -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/
Ah yeah oops, will fix and respin! Good spot [and claude missed it ugh] :)
Otherwise LGTM. Feel free to add:

Reviewed-by: Lance Yang <lance.yang@linux.dev>
quoted
		 * 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;
[...]
Thanks, Lorenzo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help