summaryrefslogtreecommitdiff
path: root/rust/kernel/page.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/kernel/page.rs')
-rw-r--r--rust/kernel/page.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/rust/kernel/page.rs b/rust/kernel/page.rs
index 75ef096075cb..432fc0297d4a 100644
--- a/rust/kernel/page.rs
+++ b/rust/kernel/page.rs
@@ -170,6 +170,12 @@ impl Page {
self.page.as_ptr()
}
+ /// Get the node id containing this page.
+ pub fn nid(&self) -> i32 {
+ // SAFETY: Always safe to call with a valid page.
+ unsafe { bindings::page_to_nid(self.as_ptr()) }
+ }
+
/// Runs a piece of code with this page mapped to an address.
///
/// The page is unmapped when this call returns.