diff options
| author | Alice Ryhl <aliceryhl@google.com> | 2026-06-15 12:36:46 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-07-10 16:58:25 +0200 |
| commit | f8d269390cd2a7a9fb5a31f153e7c7b709defea0 (patch) | |
| tree | 5a4ca31896b9cb77c9bd7b4ac0c63980d93232d3 /drivers/android | |
| parent | 63b4af40e260cf472c2946459a62060983451668 (diff) | |
| download | linux-next-f8d269390cd2a7a9fb5a31f153e7c7b709defea0.tar.gz linux-next-f8d269390cd2a7a9fb5a31f153e7c7b709defea0.zip | |
rust_binder: update Process::node_refs to use SpinLock
Unfortunately the current use of a mutex for this lock leads to priority
inversion. Traces have been observed where a process is trying to obtain
this mutex for 22ms, but it's unable to do so because the thread holding
the lock is scheduled out. Since this occurred on a UI thread, that is
an extremely long delay.
Code paths that might sleep under this lock have already been updated in
patches leading up to this one.
Reviewed-by: Matthew Maurer <mmaurer@google.com>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260615-binder-noderefs-spin-v3-6-3235f5a3e0a0@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/android')
| -rw-r--r-- | drivers/android/binder/process.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/android/binder/process.rs b/drivers/android/binder/process.rs index 7a21e4475c80..1abeb83684e4 100644 --- a/drivers/android/binder/process.rs +++ b/drivers/android/binder/process.rs @@ -30,7 +30,7 @@ use kernel::{ sync::{ aref::ARef, lock::{spinlock::SpinLockBackend, Guard}, - Arc, ArcBorrow, CondVar, CondVarTimeoutResult, Mutex, SpinLock, UniqueArc, + Arc, ArcBorrow, CondVar, CondVarTimeoutResult, SpinLock, UniqueArc, }, task::{Pid, Task}, uaccess::{UserSlice, UserSliceReader}, @@ -455,7 +455,7 @@ pub(crate) struct Process { // Node references are in a different lock to avoid recursive acquisition when // incrementing/decrementing a node in another process. #[pin] - node_refs: Mutex<ProcessNodeRefs>, + node_refs: SpinLock<ProcessNodeRefs>, // Work node for deferred work item. #[pin] @@ -510,7 +510,7 @@ impl Process { cred, inner <- kernel::new_spinlock!(ProcessInner::new(), "Process::inner"), pages <- ShrinkablePageRange::new(&super::BINDER_SHRINKER), - node_refs <- kernel::new_mutex!(ProcessNodeRefs::new(), "Process::node_refs"), + node_refs <- kernel::new_spinlock!(ProcessNodeRefs::new(), "Process::node_refs"), freeze_wait <- kernel::new_condvar!("Process::freeze_wait"), task: current.group_leader().into(), defer_work <- kernel::new_work!("Process::defer_work"), |
