[PATCH v2 0/6] rust_binder: update Process::node_refs to use SpinLock

From: Alice Ryhl

Date: Tue Jun 09 2026 - 05:49:43 EST


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.

This patch series fixes that by first making a series of changes that
remove the possibility of sleeping under the lock, and then finally
changing it to a spinlock.

Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
---
Changes in v2:
- Make more tweaks to various critical regions and extract them to
separate commits.
- Link to v1: https://lore.kernel.org/r/20260608-binder-noderefs-spin-v1-1-2584cb4e49ff@xxxxxxxxxx

---
Alice Ryhl (6):
rust_binder: avoid allocating under node_refs for freeze listeners
rust_binder: avoid dropping NodeRef in update_ref() under lock
rust_binder: schedule NodeDeath outside of node_refs lock
rust_binder: keep NodeDeath in NodeRefInfo during process cleanup
rust_binder: avoid destructors in insert_or_update_handle()
rust_binder: update Process::node_refs to use SpinLock

drivers/android/binder/freeze.rs | 67 +++++++++++++++++++++++++++------------
drivers/android/binder/node.rs | 55 ++++++++++++++++++--------------
drivers/android/binder/process.rs | 57 +++++++++++++++++++--------------
3 files changed, 111 insertions(+), 68 deletions(-)
---
base-commit: da61573f783897ae5a96c8f1c71aad6242344feb
change-id: 20260608-binder-noderefs-spin-3a0ec0589043

Best regards,
--
Alice Ryhl <aliceryhl@xxxxxxxxxx>