mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] Avoid synchronize_rcu() for every thread drop in Rust Binder
@ 2026-01-17 15:25 Alice Ryhl
  2026-01-17 15:25 ` [PATCH RFC 1/2] rust: poll: make PollCondVar upgradable Alice Ryhl
  2026-01-17 15:25 ` [PATCH RFC 2/2] rust_binder: use UpgradePollCondVar Alice Ryhl
  0 siblings, 2 replies; 3+ messages in thread
From: Alice Ryhl @ 2026-01-17 15:25 UTC (permalink / raw)
  To: Christian Brauner, Boqun Feng, Paul E. McKenney
  Cc: Gary Guo, Greg Kroah-Hartman, Carlos Llamas, linux-fsdevel,
	rust-for-linux, linux-kernel, Alice Ryhl

Right now Rust Binder calls synchronize_rcu() more often than is
necessary. Most processes do not use epoll at all, so they don't require
rcu here. Back in Kangrejos I came up with a way to avoid this. Idea is
to move the value that needs rcu to a separate allocation that's easy to
kfree_rcu(). We pay the allocation only when the proc uses epoll using
an "upgrade" strategy - most processes don't.

One solution that may be better is to just kfree_rcu() the Binder Thread
struct directly when it's refcount drops to zero (Drop of everything
else can still run without a grace period). But I'm not sure how I would
achieve that - after all Thread is also used with kernel::list.

Based on top of:
https://lore.kernel.org/all/20260117122243.24404-5-boqun.feng@gmail.com/

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
Alice Ryhl (2):
      rust: poll: make PollCondVar upgradable
      rust_binder: use UpgradePollCondVar

 drivers/android/binder/process.rs |   2 +-
 drivers/android/binder/thread.rs  |  18 +++--
 rust/kernel/sync/poll.rs          | 163 +++++++++++++++++++++++++++++++++++++-
 3 files changed, 173 insertions(+), 10 deletions(-)
---
base-commit: e0a15d3fd5100c25d1e06837bdb3070a7a716e32
change-id: 20260117-upgrade-poll-37ee2a7a79dd

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


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

end of thread, other threads:[~2026-01-17 15:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-17 15:25 [PATCH RFC 0/2] Avoid synchronize_rcu() for every thread drop in Rust Binder Alice Ryhl
2026-01-17 15:25 ` [PATCH RFC 1/2] rust: poll: make PollCondVar upgradable Alice Ryhl
2026-01-17 15:25 ` [PATCH RFC 2/2] rust_binder: use UpgradePollCondVar Alice Ryhl

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

all inboxes | Powered by JetHome®