Rust for Linux List
 help / color / mirror / Atom feed
* [PATCH v4 0/6] rust_binder: update Process::node_refs to use SpinLock
@ 2026-07-07 10:28 Alice Ryhl
  2026-07-07 10:28 ` [PATCH v4 1/6] rust_binder: avoid allocating under node_refs for freeze listeners Alice Ryhl
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Alice Ryhl @ 2026-07-07 10:28 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Carlos Llamas
  Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Matthew Maurer, rust-for-linux, linux-kernel

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.

Based on top of:
https://lore.kernel.org/all/20260707-binder-netlink-v7-0-42b40e4b1ac8@google.com/

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
Changes in v4:
- Fix conflict with commit bc4a98288978 ("rust_binder: clear freeze listener on node removal")
- Rebase on top of v7.2-rc1 and netlink series.
- Link to v3: https://lore.kernel.org/r/20260615-binder-noderefs-spin-v3-0-3235f5a3e0a0@google.com

Changes in v3:
- Clone `node` after loop in freeze listener patch.
- Inline `resize_for_add_freeze_listener` in freeze listener patch.
- Pick up Reviewed-by from Matthew.
- Link to v2: https://lore.kernel.org/r/20260609-binder-noderefs-spin-v2-0-eafde2ff376c@google.com

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@google.com

---
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  | 65 ++++++++++++++++++++++++++-------------
 drivers/android/binder/node.rs    | 41 ++++++++++++------------
 drivers/android/binder/process.rs | 57 ++++++++++++++++++++--------------
 3 files changed, 98 insertions(+), 65 deletions(-)
---
base-commit: ffdd0cba394c502b1d7c936586b2a09bb235aa8b
change-id: 20260608-binder-noderefs-spin-3a0ec0589043

Best regards,
-- 
Alice Ryhl <aliceryhl@google.com>


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-07-17 14:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-07 10:28 [PATCH v4 0/6] rust_binder: update Process::node_refs to use SpinLock Alice Ryhl
2026-07-07 10:28 ` [PATCH v4 1/6] rust_binder: avoid allocating under node_refs for freeze listeners Alice Ryhl
2026-07-17 13:20   ` Greg Kroah-Hartman
2026-07-17 13:48     ` Alice Ryhl
2026-07-17 14:35       ` Greg Kroah-Hartman
2026-07-07 10:28 ` [PATCH v4 2/6] rust_binder: avoid dropping NodeRef in update_ref() under lock Alice Ryhl
2026-07-07 10:28 ` [PATCH v4 3/6] rust_binder: schedule NodeDeath outside of node_refs lock Alice Ryhl
2026-07-07 10:28 ` [PATCH v4 4/6] rust_binder: keep NodeDeath in NodeRefInfo during process cleanup Alice Ryhl
2026-07-07 10:28 ` [PATCH v4 5/6] rust_binder: avoid destructors in insert_or_update_handle() Alice Ryhl
2026-07-07 10:28 ` [PATCH v4 6/6] rust_binder: update Process::node_refs to use SpinLock Alice Ryhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox