* [PATCH] rust: page: mark Page::nid as inline
@ 2026-05-29 8:53 Nakamura Shuta
2026-05-29 9:07 ` Alice Ryhl
2026-05-29 12:17 ` Gary Guo
0 siblings, 2 replies; 3+ messages in thread
From: Nakamura Shuta @ 2026-05-29 8:53 UTC (permalink / raw)
To: Alice Ryhl, Miguel Ojeda
Cc: Lorenzo Stoakes, Liam R . Howlett, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Danilo Krummrich, rust-for-linux, linux-mm,
linux-kernel, Nakamura Shuta
When building the kernel, the following Rust symbol is generated:
$ nm vmlinux | grep ' _R'.*Page | rustfilt
<kernel::page::Page>::nid
`Page::nid` is a trivial wrapper around the C function `page_to_nid`.
It does not make sense to go through a trivial wrapper for this function,
so mark it inline.
This follows commit 878620c5a93a ("rust: page: optimize rust symbol
generation for Page"), which did the same for `alloc_page` and `drop`.
Link: https://github.com/Rust-for-Linux/linux/issues/1145
Signed-off-by: Nakamura Shuta <nakamura.shuta@gmail.com>
---
rust/kernel/page.rs | 1 +
1 file changed, 1 insertion(+)
diff --git a/rust/kernel/page.rs b/rust/kernel/page.rs
index adecb200c654..764bb5acc90a 100644
--- a/rust/kernel/page.rs
+++ b/rust/kernel/page.rs
@@ -193,6 +193,7 @@ pub fn as_ptr(&self) -> *mut bindings::page {
}
/// Get the node id containing this page.
+ #[inline]
pub fn nid(&self) -> i32 {
// SAFETY: Always safe to call with a valid page.
unsafe { bindings::page_to_nid(self.as_ptr()) }
base-commit: 72d33b8bfeacbfdccf2cda4650e8e002def036f8
--
2.51.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rust: page: mark Page::nid as inline
2026-05-29 8:53 [PATCH] rust: page: mark Page::nid as inline Nakamura Shuta
@ 2026-05-29 9:07 ` Alice Ryhl
2026-05-29 12:17 ` Gary Guo
1 sibling, 0 replies; 3+ messages in thread
From: Alice Ryhl @ 2026-05-29 9:07 UTC (permalink / raw)
To: Nakamura Shuta, Andrew Morton
Cc: Miguel Ojeda, Lorenzo Stoakes, Liam R . Howlett, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Danilo Krummrich, rust-for-linux, linux-mm,
linux-kernel
On Fri, May 29, 2026 at 10:55 AM Nakamura Shuta
<nakamura.shuta@gmail.com> wrote:
>
> When building the kernel, the following Rust symbol is generated:
>
> $ nm vmlinux | grep ' _R'.*Page | rustfilt
> <kernel::page::Page>::nid
>
> `Page::nid` is a trivial wrapper around the C function `page_to_nid`.
> It does not make sense to go through a trivial wrapper for this function,
> so mark it inline.
>
> This follows commit 878620c5a93a ("rust: page: optimize rust symbol
> generation for Page"), which did the same for `alloc_page` and `drop`.
>
> Link: https://github.com/Rust-for-Linux/linux/issues/1145
> Signed-off-by: Nakamura Shuta <nakamura.shuta@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Andrew, can you pick this? Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rust: page: mark Page::nid as inline
2026-05-29 8:53 [PATCH] rust: page: mark Page::nid as inline Nakamura Shuta
2026-05-29 9:07 ` Alice Ryhl
@ 2026-05-29 12:17 ` Gary Guo
1 sibling, 0 replies; 3+ messages in thread
From: Gary Guo @ 2026-05-29 12:17 UTC (permalink / raw)
To: Nakamura Shuta, Alice Ryhl, Miguel Ojeda
Cc: Lorenzo Stoakes, Liam R . Howlett, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Danilo Krummrich, rust-for-linux, linux-mm,
linux-kernel
On Fri May 29, 2026 at 9:53 AM BST, Nakamura Shuta wrote:
> When building the kernel, the following Rust symbol is generated:
>
> $ nm vmlinux | grep ' _R'.*Page | rustfilt
> <kernel::page::Page>::nid
>
> `Page::nid` is a trivial wrapper around the C function `page_to_nid`.
> It does not make sense to go through a trivial wrapper for this function,
> so mark it inline.
>
> This follows commit 878620c5a93a ("rust: page: optimize rust symbol
> generation for Page"), which did the same for `alloc_page` and `drop`.
>
> Link: https://github.com/Rust-for-Linux/linux/issues/1145
> Signed-off-by: Nakamura Shuta <nakamura.shuta@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
> ---
> rust/kernel/page.rs | 1 +
> 1 file changed, 1 insertion(+)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-29 12:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-29 8:53 [PATCH] rust: page: mark Page::nid as inline Nakamura Shuta
2026-05-29 9:07 ` Alice Ryhl
2026-05-29 12:17 ` Gary Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®