Re: [PATCH 4/5] mm: add and use mmap_read_lock[_killable]_nosteal() on contention
From: Lorenzo Stoakes (ARM)
Date: Thu Nov 05 2026 - 09:10:47 EST
On Thu, Nov 05, 2026 at 11:16:23AM +0100, David Hildenbrand (Arm) wrote:
> On 11/3/26 09:27, Lorenzo Stoakes (ARM) wrote:
> > With down_read[_killable]_nosteal() available, it becomes possible to
> > release the mmap read lock in such a way that a queued write lock always
> > takes precedence.
> >
> > Expose this to mm through two new wrappers - mmap_read_lock_nosteal() and
> > mmap_read_lock_killable_nosteal().
> >
> > Make use of this in scenarios where the mmap read lock is dropped
> > explicitly for the purposes of relieving mmap_lock contention - the BPF
> > task VMA iterator, and lock_next_vma_under_mmap_lock(), which is where
> > /proc/$pid/smaps_rollup re-acquires the mmap lock after dropping it on
> > contention and falling back from per-VMA locking.
> >
> > Signed-off-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
> > ---
> > include/linux/mmap_lock.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
> > kernel/bpf/task_iter.c | 2 +-
>
>
> I'd appreciate an ack from BPF folks and a confirmation that I could take this
> through my tree :)
With the rwsem thing as a separate patch this patch will be dropped in any case,
which simplifies things :)
--
Cheers, Lorenzo