[PATCH v2] rust: sync: completion: mark inline complete_all and wait_for_completion

Fabricio Parra posted 1 patch 3 weeks ago
rust/kernel/sync/completion.rs | 2 ++
1 file changed, 2 insertions(+)
[PATCH v2] rust: sync: completion: mark inline complete_all and wait_for_completion
Posted by Fabricio Parra 3 weeks ago
When building the kernel using the llvm-22.1.0-rust-1.93.1-x86_64
toolchain provided by kernel.org with ARCH=x86_64, the following symbols
are generated:

$ nm vmlinux | grep ' _R'.*Completion | rustfilt
ffffffff81827930 T <kernel::sync::completion::Completion>::complete_all
ffffffff81827950 T <kernel::sync::completion::Completion>::wait_for_completion

These Rust methods are thin wrappers around the C completion helpers
`complete_all` and `wait_for_completion`. Mark them `#[inline]` to keep
the wrapper pattern consistent with other small Rust helper methods.

After applying this patch, the above command will produce no output.

Link: https://github.com/Rust-for-Linux/linux/issues/1145
Suggested-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Fabricio Parra <a@alice0.com>
---
v2:
  - Fixed malformed email header (RFC 5322) in the From line.

 rust/kernel/sync/completion.rs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/rust/kernel/sync/completion.rs b/rust/kernel/sync/completion.rs
index c50012a940a3..35ff049ff078 100644
--- a/rust/kernel/sync/completion.rs
+++ b/rust/kernel/sync/completion.rs
@@ -94,6 +94,7 @@ fn as_raw(&self) -> *mut bindings::completion {
     ///
     /// This method wakes up all tasks waiting on this completion; after this operation the
     /// completion is permanently done, i.e. signals all current and future waiters.
+    #[inline]
     pub fn complete_all(&self) {
         // SAFETY: `self.as_raw()` is a pointer to a valid `struct completion`.
         unsafe { bindings::complete_all(self.as_raw()) };
@@ -105,6 +106,7 @@ pub fn complete_all(&self) {
     /// timeout.
     ///
     /// See also [`Completion::complete_all`].
+    #[inline]
     pub fn wait_for_completion(&self) {
         // SAFETY: `self.as_raw()` is a pointer to a valid `struct completion`.
         unsafe { bindings::wait_for_completion(self.as_raw()) };

base-commit: 79e25710e7227228902d672417b552dd1d7e5d3b
-- 
2.53.0
Re: [PATCH v2] rust: sync: completion: mark inline complete_all and wait_for_completion
Posted by Gary Guo 3 weeks ago
On Mon Mar 16, 2026 at 3:10 PM GMT, Fabricio Parra wrote:
> When building the kernel using the llvm-22.1.0-rust-1.93.1-x86_64
> toolchain provided by kernel.org with ARCH=x86_64, the following symbols
> are generated:
> 
> $ nm vmlinux | grep ' _R'.*Completion | rustfilt
> ffffffff81827930 T <kernel::sync::completion::Completion>::complete_all
> ffffffff81827950 T <kernel::sync::completion::Completion>::wait_for_completion
> 
> These Rust methods are thin wrappers around the C completion helpers
> `complete_all` and `wait_for_completion`. Mark them `#[inline]` to keep
> the wrapper pattern consistent with other small Rust helper methods.
> 
> After applying this patch, the above command will produce no output.
> 
> Link: https://github.com/Rust-for-Linux/linux/issues/1145
> Suggested-by: Alice Ryhl <aliceryhl@google.com>
> Signed-off-by: Fabricio Parra <a@alice0.com>

Reviewed-by: Gary Guo <gary@garyguo.net>

> ---
> v2:
>   - Fixed malformed email header (RFC 5322) in the From line.
> 
>  rust/kernel/sync/completion.rs | 2 ++
>  1 file changed, 2 insertions(+)
Re: [PATCH v2] rust: sync: completion: mark inline complete_all and wait_for_completion
Posted by Boqun Feng 2 weeks, 5 days ago
On Mon, Mar 16, 2026 at 03:16:50PM +0000, Gary Guo wrote:
> On Mon Mar 16, 2026 at 3:10 PM GMT, Fabricio Parra wrote:
> > When building the kernel using the llvm-22.1.0-rust-1.93.1-x86_64
> > toolchain provided by kernel.org with ARCH=x86_64, the following symbols
> > are generated:
> > 
> > $ nm vmlinux | grep ' _R'.*Completion | rustfilt
> > ffffffff81827930 T <kernel::sync::completion::Completion>::complete_all
> > ffffffff81827950 T <kernel::sync::completion::Completion>::wait_for_completion
> > 
> > These Rust methods are thin wrappers around the C completion helpers
> > `complete_all` and `wait_for_completion`. Mark them `#[inline]` to keep
> > the wrapper pattern consistent with other small Rust helper methods.
> > 
> > After applying this patch, the above command will produce no output.
> > 
> > Link: https://github.com/Rust-for-Linux/linux/issues/1145
> > Suggested-by: Alice Ryhl <aliceryhl@google.com>
> > Signed-off-by: Fabricio Parra <a@alice0.com>
> 
> Reviewed-by: Gary Guo <gary@garyguo.net>
> 

Queued in rust-sync, thank you!

Regards,
Boqun

> > ---
> > v2:
> >   - Fixed malformed email header (RFC 5322) in the From line.
> > 
> >  rust/kernel/sync/completion.rs | 2 ++
> >  1 file changed, 2 insertions(+)
>