aboutsummaryrefslogtreecommitdiffstats
path: root/rust/helpers/mm.c
diff options
context:
space:
mode:
authorAlice Ryhl <[email protected]>2025-04-08 09:22:41 +0000
committerAndrew Morton <[email protected]>2025-05-12 00:48:24 +0000
commit3105f8f391ce00153c553bfe89efbb30b120d858 (patch)
tree6f2e51f06739962c6f768dbc5dd0578e236aca96 /rust/helpers/mm.c
parentmm: rust: add vm_insert_page (diff)
downloadkernel-3105f8f391ce00153c553bfe89efbb30b120d858.tar.gz
kernel-3105f8f391ce00153c553bfe89efbb30b120d858.zip
mm: rust: add lock_vma_under_rcu
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. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Alice Ryhl <[email protected]> Acked-by: Lorenzo Stoakes <[email protected]> Acked-by: Liam R. Howlett <[email protected]> Reviewed-by: Jann Horn <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Reviewed-by: Gary Guo <[email protected]> Cc: Alex Gaynor <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Balbir Singh <[email protected]> Cc: Benno Lossin <[email protected]> Cc: Björn Roy Baron <[email protected]> Cc: Boqun Feng <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: John Hubbard <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Trevor Gross <[email protected]> Cc: Vlastimil Babka <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'rust/helpers/mm.c')
-rw-r--r--rust/helpers/mm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/rust/helpers/mm.c b/rust/helpers/mm.c
index 7b72eb065a3e..81b510c96fd2 100644
--- a/rust/helpers/mm.c
+++ b/rust/helpers/mm.c
@@ -43,3 +43,8 @@ struct vm_area_struct *rust_helper_vma_lookup(struct mm_struct *mm,
{
return vma_lookup(mm, addr);
}
+
+void rust_helper_vma_end_read(struct vm_area_struct *vma)
+{
+ vma_end_read(vma);
+}