rust: sync: optimize Rust symbol generation for PollCondVar
PATCH v2 1/1 rust: sync: optimize Rust symbol generation for PollCondVar
From: Kunwu Chan <[email protected]>
When build the kernel using the llvm-18.1.3-rust-1.85.0-x86_64 with ARCH=arm64, the following symbols are generated:
$nm vmlinux | grep ' _R'.*PollCondVar | rustfilt
... T <kernel::sync::poll::PollCondVar>::new::{closure#0}::{closure#0}::panic_cold_explicit ... T <kernel::sync::poll::PollCondVar as kernel::init::PinnedDrop>::drop ... T <kernel::sync::poll::PollCondVar as core::ops::drop::Drop>::drop
This Rust symbol
(<kernel::sync::poll::PollCondVar as kernel::init::PinnedDrop>::drop) is trivial wrappers around the C functions __wake_up_pollfree and synchronize_rcu. It doesn't make sense to go through a trivial wrapper for its functions,so mark it inline.
---
Changes in v2:
- Add link and Suggested-by
- Reword commit msg
--- rust/kernel/sync/poll.rs | 1 + 1 file changed, 1 insertion(+)
rust/kernel/sync/poll.rs +1 -0
@@ -107,6 +107,7 @@ fn deref(&self) -> &CondVar {#[pinned_drop] impl PinnedDrop for PollCondVar { +#[inline] fn drop (self:Pin <&mut Self >) {// Clear anything registered using `register_wait`. //
Signature · 1 line
2.43.0
Quoted 16 lines · Kunwu Chan
From: Kunwu Chan <[email protected]>
When build the kernel using the llvm-18.1.3-rust-1.85.0-x86_64 with ARCH=arm64, the following symbols are generated:
$nm vmlinux | grep ' _R'.*PollCondVar | rustfilt
... T <kernel::sync::poll::PollCondVar>::new::{closure#0}::{closure#0}::panic_cold_explicit ... T <kernel::sync::poll::PollCondVaras kernel::init::PinnedDrop>::drop ... T <kernel::sync::poll::PollCondVaras core::ops::drop::Drop>::dropThis Rust symbol
(<kernel::sync::poll::PollCondVaras kernel::init::PinnedDrop>::drop) is trivial wrappers around the C functions__wake_up_pollfreeandsynchronize_rcu. It doesn't make sense to go through a trivial wrapper for its functions,so mark it inline.
Quoted 5 lines
Suggested-by Alice Ryhl <[email protected]>Co-developed-by Grace Deng <[email protected]>Signed-off-by Grace Deng <[email protected]>Signed-off-by Kunwu Chan <[email protected]>
---
Cheers,
Benno
Quoted 7 lines
---
Changes in v2:
- Add link and Suggested-by
- Reword commit msg--- rust/kernel/sync/poll.rs | 1 + 1 file changed, 1 insertion(+)
Quoted 16 lines · Kunwu Chan
From: Kunwu Chan <[email protected]>
When build the kernel using the llvm-18.1.3-rust-1.85.0-x86_64 with ARCH=arm64, the following symbols are generated:
$nm vmlinux | grep ' _R'.*PollCondVar | rustfilt
... T <kernel::sync::poll::PollCondVar>::new::{closure#0}::{closure#0}::panic_cold_explicit ... T <kernel::sync::poll::PollCondVaras kernel::init::PinnedDrop>::drop ... T <kernel::sync::poll::PollCondVaras core::ops::drop::Drop>::dropThis Rust symbol
(<kernel::sync::poll::PollCondVaras kernel::init::PinnedDrop>::drop) is trivial wrappers around the C functions__wake_up_pollfreeandsynchronize_rcu. It doesn't make sense to go through a trivial wrapper for its functions,so mark it inline.
Quoted 5 lines
Suggested-by Alice Ryhl <[email protected]>Co-developed-by Grace Deng <[email protected]>Signed-off-by Grace Deng <[email protected]>Signed-off-by Kunwu Chan <[email protected]>
Quoted 16 lines · Kunwu Chan
From: Kunwu Chan <[email protected]>
When build the kernel using the llvm-18.1.3-rust-1.85.0-x86_64 with ARCH=arm64, the following symbols are generated:
$nm vmlinux | grep ' _R'.*PollCondVar | rustfilt
... T <kernel::sync::poll::PollCondVar>::new::{closure#0}::{closure#0}::panic_cold_explicit ... T <kernel::sync::poll::PollCondVaras kernel::init::PinnedDrop>::drop ... T <kernel::sync::poll::PollCondVaras core::ops::drop::Drop>::dropThis Rust symbol
(<kernel::sync::poll::PollCondVaras kernel::init::PinnedDrop>::drop) is trivial wrappers around the C functions__wake_up_pollfreeandsynchronize_rcu. It doesn't make sense to go through a trivial wrapper for its functions,so mark it inline.
Quoted 6 lines
Suggested-by Alice Ryhl <[email protected]>Co-developed-by Grace Deng <[email protected]>Signed-off-by Grace Deng <[email protected]>Signed-off-by Kunwu Chan <[email protected]>
Queued for future tests and reviews. Thanks!
Regards,
Boqun
Quoted 23 lines
---
Changes in v2:
- Add link and Suggested-by
- Reword commit msg--- rust/kernel/sync/poll.rs | 1 + 1 file changed, 1 insertion(+)rust/kernel/sync/poll.rs +1
-0@@ -107,6 +107,7 @@ fn deref(&self) -> &CondVar {#[pinned_drop] impl PinnedDrop for PollCondVar { +#[inline] fn drop (self:Pin <&mut Self >) {// Clear anything registered using `register_wait`. // Signature · 1 line
2.43.0
Quoted 17 lines · Boqun Feng
Quoted 16 lines · Kunwu Chan
From: Kunwu Chan <[email protected]>
When build the kernel using the llvm-18.1.3-rust-1.85.0-x86_64 with ARCH=arm64, the following symbols are generated:
$nm vmlinux | grep ' _R'.*PollCondVar | rustfilt
... T <kernel::sync::poll::PollCondVar>::new::{closure#0}::{closure#0}::panic_cold_explicit ... T <kernel::sync::poll::PollCondVaras kernel::init::PinnedDrop>::drop ... T <kernel::sync::poll::PollCondVaras core::ops::drop::Drop>::dropThis Rust symbol
(<kernel::sync::poll::PollCondVaras kernel::init::PinnedDrop>::drop) is trivial wrappers around the C functions__wake_up_pollfreeandsynchronize_rcu. It doesn't make sense to go through a trivial wrapper for its functions,so mark it inline.
Quoted 7 lines
Quoted 6 lines
Suggested-by Alice Ryhl <[email protected]>Co-developed-by Grace Deng <[email protected]>Signed-off-by Grace Deng <[email protected]>Signed-off-by Kunwu Chan <[email protected]>Queued for future tests and reviews. Thanks!
Ok, if need do testing-related work, feel free to contact me
Quoted 27 lines
Regards,
BoqunQuoted 23 lines
---
Changes in v2:
- Add link and Suggested-by
- Reword commit msg--- rust/kernel/sync/poll.rs | 1 + 1 file changed, 1 insertion(+)rust/kernel/sync/poll.rs +1
-0@@ -107,6 +107,7 @@ fn deref(&self) -> &CondVar {#[pinned_drop] impl PinnedDrop for PollCondVar { +#[inline] fn drop (self:Pin <&mut Self >) {// Clear anything registered using `register_wait`. // Signature · 1 line
2.43.0
Signature · 2 lines
Thanks, Kunwu.Chan(Tao.Chan)
[tip: sched/core] rust: sync: Mark PollCondVar::drop() inline
In reply to Kunwu ChanThe following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 11867144ff81ab98f4b11c99716c3e8b714b8755 Gitweb: https://git.kernel.org/tip/11867144ff81ab98f4b11c99716c3e8b714b8755 Author: Kunwu Chan <[email protected]> AuthorDate: Mon, 17 Mar 2025 10:52:05 +08:00 Committer: Boqun Feng <[email protected]> CommitterDate: Tue, 24 Jun 2025 10:23:48 -07:00
rust: sync: Mark PollCondVar::drop() inline
When building the kernel using the llvm-18.1.3-rust-1.85.0-x86_64 with ARCH=arm64, the following symbols are generated:
$nm vmlinux | grep ' _R'.*PollCondVar | rustfilt
... T <kernel::sync::poll::PollCondVar as kernel::init::PinnedDrop>::drop
...
This Rust symbol is trivial wrappers around the C functions __wake_up_pollfree() and synchronize_rcu(). It doesn't make sense to go through a trivial wrapper for its functions, so mark it inline.
[boqun: Reword the commit title and re-format the commit log per tip tree's requirement, remove unnecessary information from "nm vmlinux" result.]
--- rust/kernel/sync/poll.rs | 1 + 1 file changed, 1 insertion(+)
rust/kernel/sync/poll.rs +1 -0
@@ -107,6 +107,7 @@ impl Deref for PollCondVar {#[pinned_drop] impl PinnedDrop for PollCondVar { +#[inline] fn drop (self:Pin <&mut Self >) {// Clear anything registered using `register_wait`. //