Re: [PATCH v2 1/5] mm: Make per-VMA locks available universally

From: Vlastimil Babka (SUSE)

Date: Fri Jun 12 2026 - 10:14:37 EST


On 6/11/26 01:04, Dave Hansen wrote:

Not a Rust expert but...

> --- a/rust/kernel/mm.rs~unconditional-vma-locks 2026-06-10 15:57:54.051368539 -0700
> +++ b/rust/kernel/mm.rs 2026-06-10 15:57:54.078369499 -0700
> @@ -174,7 +174,6 @@ impl MmWithUser {
> /// When per-vma locks are disabled, this always returns `None`.
> #[inline]
> pub fn lock_vma_under_rcu(&self, vma_addr: usize) -> Option<VmaReadGuard<'_>> {
> - #[cfg(CONFIG_PER_VMA_LOCK)]
> {
> // SAFETY: Calling `bindings::lock_vma_under_rcu` is always okay given an mm where
> // `mm_users` is non-zero.
> @@ -188,12 +187,6 @@ impl MmWithUser {
> });
> }
> }

Think you can remove the { } as well (as that was the scope of #[cfg] and
reduce indentation of what's inside.

> -
> - // Silence warnings about unused variables.
> - #[cfg(not(CONFIG_PER_VMA_LOCK))]
> - let _ = vma_addr;
> -
> - None

And here you should leave the 'None' as the #[cfg] only applied to the one
line below.

> }
>
> /// Lock the mmap read lock.
> diff -puN tools/testing/vma/include/dup.h~unconditional-vma-locks tools/testing/vma/include/dup.h