mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 14:33:24 -04:00
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
63b4af40e2
commit
f8d269390c
@@ -30,7 +30,7 @@
|
||||
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 @@ fn new(ctx: Arc<Context>, cred: ARef<Credential>) -> Result<Arc<Self>> {
|
||||
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"),
|
||||
|
||||
Reference in New Issue
Block a user