[PATCH] rust: page: mark Page::nid as inline

From: Nakamura Shuta

Date: Fri May 29 2026 - 05:00:58 EST


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@xxxxxxxxx>
---
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