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

From: SeongJae Park
Date: Mon Jun 02 2025 - 13:35:36 EST


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.


Thanks,
SJ

[...]