* Re: [PATCH 7.3 463/507] mm/vma: avoid spurious write locks when mm->mm_lock_seq overflows
[not found] <20261113153812.408825269@linuxfoundation.org>
@ 2026-11-14 0:39 ` Miguel Ojeda
2026-11-14 3:19 ` SJ Park
0 siblings, 1 reply; 2+ messages in thread
From: Miguel Ojeda @ 2026-11-14 0:39 UTC (permalink / raw)
To: gregkh
Cc: 4ncienth, akpm, azpijr, corbet, david, jannh, liam, ljs, mhocko,
patches, pfalcato, rdunlap, rppt, sashal, shakeel.butt, stable,
surenb, vbabka, linux-mm, Dave Hansen
On Fri, 13 Nov 2026 10:52:47 -0500 Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>
> @@ -589,6 +593,16 @@ static inline void vma_end_write_all(struct mm_struct *mm)
> {
> mmap_assert_write_locked(mm);
> mm_lock_seqcount_end(mm);
> +
> + /*
> + * VMA seqcounts are not updated on unlock, so once the mm seqcount has
> + * wrapped, any VMA still carrying a sequence number from before the
> + * wrap would satisfy __is_vma_write_locked() when that number comes
> + * round again, and readers would not be excluded. Reset every VMA's
> + * seqcount so that no stale value survives the wrap.
> + */
> + if (unlikely(!mm->mm_lock_seq.sequence))
> + __mm_reset_vma_seqcounts(mm);
> }
In a UM ~defconfig build with LLVM:
In file included from arch/um/kernel/asm-offsets.c:8:
In file included from ./include/linux/audit.h:13:
In file included from ./include/linux/ptrace.h:10:
In file included from ./include/linux/pid_namespace.h:7:
In file included from ./include/linux/mm.h:18:
./include/linux/mmap_lock.h:604:20: error: no member named 'mm_lock_seq' in 'struct mm_struct'
604 | if (unlikely(!mm->mm_lock_seq.sequence))
| ~~ ^
./include/linux/compiler.h:77:42: note: expanded from macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
|
That exists only under `CONFIG_PER_VMA_LOCK` (commit 47e725702b0b ("mm:
make per-VMA locks available universally") from Dave's series was not
backported).
I hope this helps!
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: linux-mm@kvack.org
Cc: Jose A. Perez de Azpillaga <azpijr@gmail.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Hildenbrand (Arm) <david@kernel.org>
Cheers,
Miguel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 7.3 463/507] mm/vma: avoid spurious write locks when mm->mm_lock_seq overflows
2026-11-14 0:39 ` [PATCH 7.3 463/507] mm/vma: avoid spurious write locks when mm->mm_lock_seq overflows Miguel Ojeda
@ 2026-11-14 3:19 ` SJ Park
0 siblings, 0 replies; 2+ messages in thread
From: SJ Park @ 2026-11-14 3:19 UTC (permalink / raw)
To: Miguel Ojeda
Cc: SJ Park, gregkh, 4ncienth, akpm, azpijr, corbet, david, jannh,
liam, ljs, mhocko, patches, pfalcato, rdunlap, rppt, sashal,
shakeel.butt, stable, surenb, vbabka, linux-mm, Dave Hansen
On Sat, 14 Nov 2026 01:39:12 +0100 Miguel Ojeda <ojeda@kernel.org> wrote:
> On Fri, 13 Nov 2026 10:52:47 -0500 Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> >
> > @@ -589,6 +593,16 @@ static inline void vma_end_write_all(struct mm_struct *mm)
> > {
> > mmap_assert_write_locked(mm);
> > mm_lock_seqcount_end(mm);
> > +
> > + /*
> > + * VMA seqcounts are not updated on unlock, so once the mm seqcount has
> > + * wrapped, any VMA still carrying a sequence number from before the
> > + * wrap would satisfy __is_vma_write_locked() when that number comes
> > + * round again, and readers would not be excluded. Reset every VMA's
> > + * seqcount so that no stale value survives the wrap.
> > + */
> > + if (unlikely(!mm->mm_lock_seq.sequence))
> > + __mm_reset_vma_seqcounts(mm);
> > }
>
> In a UM ~defconfig build with LLVM:
>
> In file included from arch/um/kernel/asm-offsets.c:8:
> In file included from ./include/linux/audit.h:13:
> In file included from ./include/linux/ptrace.h:10:
> In file included from ./include/linux/pid_namespace.h:7:
> In file included from ./include/linux/mm.h:18:
> ./include/linux/mmap_lock.h:604:20: error: no member named 'mm_lock_seq' in 'struct mm_struct'
> 604 | if (unlikely(!mm->mm_lock_seq.sequence))
> | ~~ ^
> ./include/linux/compiler.h:77:42: note: expanded from macro 'unlikely'
> 77 | # define unlikely(x) __builtin_expect(!!(x), 0)
> |
>
> That exists only under `CONFIG_PER_VMA_LOCK` (commit 47e725702b0b ("mm:
> make per-VMA locks available universally") from Dave's series was not
> backported).
I found same thing while running kunit. I also confirmed both applying commit
47e725702b0b from Dave and reverting this patch fix the problem on my setup.
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-14 3:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20261113153812.408825269@linuxfoundation.org>
2026-11-14 0:39 ` [PATCH 7.3 463/507] mm/vma: avoid spurious write locks when mm->mm_lock_seq overflows Miguel Ojeda
2026-11-14 3:19 ` SJ Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox