Re: [PATCH 3/3] mm: convert WARN_ON_ONCE()'s to VM_WARN_ON_ONCE() in VMA lock code

From: Vlastimil Babka (SUSE)

Date: Wed Nov 11 2026 - 04:41:06 EST


On 11/10/26 17:57, Lorenzo Stoakes (ARM) wrote:
> Now that VMA assertions are predicated on CONFIG_DEBUG_VM, it makes sense
> to convert existing unconditional WARN_ON_ONCE()'s in VMA lock code to
> VM_WARN_ON_ONCE()'s.
>
> These are asserting programmatic invariants which are in most other cases
> asserted using VM_WARN_ON_ONCE(), and there is simply no need for these to
> be unconditionally checked, so no longer do so.
>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>

Reviewed-by: Vlastimil Babka (SUSE) <vbabka@xxxxxxxxxx>

> ---
> mm/mmap_lock.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c
> index 834bbf86e004..073c5125b424 100644
> --- a/mm/mmap_lock.c
> +++ b/mm/mmap_lock.c
> @@ -146,7 +146,7 @@ int __vma_start_write(struct vm_area_struct *vma, int state)
>
> err = __vma_start_exclude_readers(&ves);
> if (err) {
> - WARN_ON_ONCE(ves.detached);
> + VM_WARN_ON_ONCE(ves.detached);
> return err;
> }
>
> @@ -161,7 +161,7 @@ int __vma_start_write(struct vm_area_struct *vma, int state)
> if (ves.exclusive) {
> __vma_end_exclude_readers(&ves);
> /* VMA should remain attached. */
> - WARN_ON_ONCE(ves.detached);
> + VM_WARN_ON_ONCE(ves.detached);
> }
>
> return 0;
> @@ -193,7 +193,7 @@ void __vma_exclude_readers_for_detach(struct vm_area_struct *vma)
> __vma_end_exclude_readers(&ves);
> }
> /* If an error arose but we were detached anyway, we don't care. */
> - WARN_ON_ONCE(!ves.detached);
> + VM_WARN_ON_ONCE(!ves.detached);
> }
>
> /* Do the VMA, mm seqcounts indicate the VMA is write locked? */
>