Re: [PATCH v6 1/2] rust: poll: use kfree_rcu() for PollCondVar
From: Boqun Feng
Date: Fri Jul 10 2026 - 10:29:48 EST
On Tue, Jul 07, 2026 at 10:43:12AM +0000, Alice Ryhl wrote:
> Rust Binder currently uses PollCondVar, but it calls synchronize_rcu()
> in the destructor, which we would like to avoid. Add a variation of
> PollCondVar that kfree_rcu() instead.
>
> One could avoid the `rcu` field and allocate the rcu_head on drop using
> a fallback to synchronize_rcu() on ENOMEM. However, I'd prefer to avoid
> the potential for synchronize_rcu(), and Binder will only use this for a
> small fraction of processes, so even if it changes which kmalloc bucket
> it falls into, the extra memory is not a problem.
>
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
Let's switch to a better abstraction like RcuFreeBox later, but I don't
see any issue of this approach in general.
Reviewed-by: Boqun Feng <boqun@xxxxxxxxxx>
Regards,
Boqun
> ---
> rust/kernel/sync/poll.rs | 73 +++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 72 insertions(+), 1 deletion(-)
>
[..]