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.
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
Changes in v4:
- Use SetOnce for PollCondVar variable instead of storing inside
spinlock. This avoids calling poll_wait() under the spinlock.
- Link to v3: https://lore.kernel.org/r/20260508-upgrade-poll-v3-0-0c619fe846e8@google.com
Changes in v3:
- This series was almost entirely rewritten to use a different
implementation strategy. By moving the PollCondVar to the process we
can avoid the upgrade logic entirely.
- Link to v2: https://lore.kernel.org/r/20260213-upgrade-poll-v2-0-984a0fb184fb@google.com
Changes in v2:
- Change how Rust Binder handles the lock class key.
- Rebase.
- Link to v1: https://lore.kernel.org/r/20260117-upgrade-poll-v1-0-179437b7bd49@google.com
---
Alice Ryhl (2):
rust: poll: use kfree_rcu() for PollCondVar
rust_binder: move (e)poll wait queue to Process
drivers/android/binder/node.rs | 4 +-
drivers/android/binder/process.rs | 74 +++++++++++++++++++++++++--------
drivers/android/binder/thread.rs | 78 +++++++++++++++++------------------
drivers/android/binder/transaction.rs | 6 ++-
rust/kernel/sync/poll.rs | 73 +++++++++++++++++++++++++++++++-
5 files changed, 174 insertions(+), 61 deletions(-)
---
base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
change-id: 20260117-upgrade-poll-37ee2a7a79dd
Best regards,
--
Alice Ryhl <aliceryhl@google.com>