Re: [PATCH RFC v2] mm: use per_vma lock for MADV_DONTNEED

From: SeongJae Park
Date: Mon Jun 02 2025 - 13:53:21 EST


On Mon, 2 Jun 2025 10:35:19 -0700 SeongJae Park <sj@xxxxxxxxxx> wrote:

> On Sat, 31 May 2025 04:17:51 +0800 Barry Song <21cnbao@xxxxxxxxx> wrote:
> [...]
> > BTW, I found vector_madvise doesn't check the ret value of madvise_lock(),
> > it seems also a bug?
> >
> > static ssize_t vector_madvise(struct mm_struct *mm, struct iov_iter *iter,
> > {
> > /* Drop and reacquire lock to unwind race. */
> > madvise_finish_tlb(&madv_behavior);
> > madvise_unlock(mm, behavior);
> > madvise_lock(mm, behavior); /* missing the ret check */
> > madvise_init_tlb(&madv_behavior, mm)
> > }
>
> Thank you for finding this, I will post a fix soon.

The fix is now available at
https://lore.kernel.org/20250602174926.1074-1-sj@xxxxxxxxxx


Thanks,
SJ

[...]