Re: [PATCH 3/3] rust: sync: Use safe synchronize_rcu() abstraction in poll

Onur Özkan <[email protected]>
Newsgroups org.kernel.vger.rcu,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
On Thu, 18 Jun 2026 11:59:52 +0200
Philipp Stanner <[email protected]> wrote:

> We now have a safe wrapper for the foreign function synchronize_rcu().
> 
> Use it in poll.rs.
> 
> Signed-off-by: Philipp Stanner <[email protected]>
> ---
>  rust/kernel/sync/poll.rs | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/rust/kernel/sync/poll.rs b/rust/kernel/sync/poll.rs
> index 0ec985d560c8..401cf4d3f35f 100644
> --- a/rust/kernel/sync/poll.rs
> +++ b/rust/kernel/sync/poll.rs
> @@ -8,7 +8,7 @@
>      bindings,
>      fs::File,
>      prelude::*,
> -    sync::{CondVar, LockClassKey},
> +    sync::{rcu::synchronize_rcu, CondVar, LockClassKey},

nit: Missing vertical import. Same in the other module as well.

Thanks,
Onur

>  };
>  use core::{marker::PhantomData, ops::Deref};
>  
> @@ -99,8 +99,6 @@ fn drop(self: Pin<&mut Self>) {
>          unsafe { bindings::__wake_up_pollfree(self.inner.wait_queue_head.get()) };
>  
>          // Wait for epoll items to be properly removed.
> -        //
> -        // SAFETY: Just an FFI call.
> -        unsafe { bindings::synchronize_rcu() };
> +        synchronize_rcu();
>      }
>  }
> -- 
> 2.54.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.