Skip to contentSkip to conversation

rust: sync: completion: mark inline complete_all and wait_for_completion

PATCH In review Fabricio Parra [email protected] 4 participants 6 messages Mar 16 – Mar 18

Subsystems (2)
lore
Share & tools
lore

Fabricio Parra [email protected]

author
#0 lore raw

PATCH 1/1 rust: sync: completion: mark inline complete_all and wait_for_completion

From: Fabricio Parra <[email protected]>

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.

---
 rust/kernel/sync/completion.rs | 2 ++
 1 file changed, 2 insertions(+)
rust/kernel/sync/completion.rs +2 -0
index c50012a940a3..35ff049ff078 100644
@@ -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

Signature · 1 line
2.53.0
maintainer
#1 lore raw
Quoted 1 line · GMT,

From: Fabricio Parra <[email protected]>

Your email header is malformed. It has "Fabricio Parra [email protected]" in the from line instead of expected RFC 5322 format. People won't be able to just reply to this email and get it delivered to your inbox.

Please check and fix your git or email configuration.

Best,
Gary

Quoted 44 lines

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.

---
 rust/kernel/sync/completion.rs | 2 ++
 1 file changed, 2 insertions(+)
rust/kernel/sync/completion.rs +2 -0
index c50012a940a3..35ff049ff078 100644
@@ -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 lore raw
Quoted 4 lines · GMT Gary Guo
Quoted 1 line · GMT,

From: Fabricio Parra <[email protected]>

Quoted 9 lines

Your email header is malformed. It has "Fabricio Parra [email protected]" in the from line instead of expected RFC 5322 format. People won't be able to just reply to this email and get it delivered to your inbox.

Please check and fix your git or email configuration.

Best,
Gary

My bad, I completely messed up my git-send-email config while I was setting it up. I'll send a v2 with fixed headers shortly, thank you for pointing it out!

Regards,
Fabricio

Quoted 46 lines
Quoted 44 lines

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.

---
 rust/kernel/sync/completion.rs | 2 ++
 1 file changed, 2 insertions(+)
rust/kernel/sync/completion.rs +2 -0
index c50012a940a3..35ff049ff078 100644
@@ -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

#3 lore raw

PATCH v2 1/1 rust: sync: completion: mark inline complete_all and wait_for_completion

In reply to Gary Guo

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.

---
v2:
- Fixed malformed email header (RFC 5322) in the From line.

 rust/kernel/sync/completion.rs | 2 ++
 1 file changed, 2 insertions(+)
rust/kernel/sync/completion.rs +2 -0
index c50012a940a3..35ff049ff078 100644
@@ -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

Signature · 1 line
2.53.0
maintainer Reviewed-by on v2 1/1
#4 lore raw
Quoted 12 lines · Fabricio Parra

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.

Quoted 5 lines

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

Quoted 6 lines

---
v2:
- Fixed malformed email header (RFC 5322) in the From line.

 rust/kernel/sync/completion.rs | 2 ++
 1 file changed, 2 insertions(+)
maintainer Applied
#5 lore raw
Quoted 13 lines · Gary Guo
Quoted 12 lines · Fabricio Parra

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.

Quoted 8 lines
Quoted 5 lines

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

Queued in rust-sync, thank you!

Regards,
Boqun

Quoted 7 lines
Quoted 6 lines

---
v2:
- Fixed malformed email header (RFC 5322) in the From line.

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