Re: [PATCH v14 4/8] mm: rust: add lock_vma_under_rcu
From: Gary Guo
Date: Tue Feb 25 2025 - 11:32:01 EST
On Thu, 13 Feb 2025 11:04:03 +0000
Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
> Currently, the binder driver always uses the mmap lock to make changes
> to its vma. Because the mmap lock is global to the process, this can
> involve significant contention. However, the kernel has a feature called
> per-vma locks, which can significantly reduce contention. For example,
> you can take a vma lock in parallel with an mmap write lock. This is
> important because contention on the mmap lock has been a long-term
> recurring challenge for the Binder driver.
>
> This patch introduces support for using `lock_vma_under_rcu` from Rust.
> The Rust Binder driver will be able to use this to reduce contention on
> the mmap lock.
>
> Acked-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> Reviewed-by: Jann Horn <jannh@xxxxxxxxxx>
> Reviewed-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>
> ---
> rust/helpers/mm.c | 5 +++++
> rust/kernel/mm.rs | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++