* [PATCH v2] rust: alloc: add `NumaNode::id()` accessor
@ 2026-09-29 15:18 Andreas Hindborg
2026-09-29 16:27 ` Gary Guo
2026-09-29 19:15 ` Danilo Krummrich
0 siblings, 2 replies; 3+ messages in thread
From: Andreas Hindborg @ 2026-09-29 15:18 UTC (permalink / raw)
To: Danilo Krummrich, Lorenzo Stoakes, Vlastimil Babka,
Liam R. Howlett, Uladzislau Rezki, Miguel Ojeda, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Alice Ryhl, Trevor Gross, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan
Cc: rust-for-linux, linux-kernel
`NumaNode` wraps an `i32` but offers no way to read it back. Add a
trivial `id()` getter so callers that need to pass the node id to a
C binding can recover the underlying `c_int` without reaching into
the private field.
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
---
Changes in v2:
- Rebase on v7.3-rc5.
- Add `#[inline]` attribute (Alice, Gary).
- Link to v1: https://msgid.link/20260608-numa-node-id-v1-1-28480299c62d@kernel.org
---
This will be used by an upcoming change that adds a home node parameter to
the block layer `TagSet::new()` constructor.
---
rust/kernel/alloc.rs | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/rust/kernel/alloc.rs b/rust/kernel/alloc.rs
index 21067bde6860..68d80f3fa6c8 100644
--- a/rust/kernel/alloc.rs
+++ b/rust/kernel/alloc.rs
@@ -130,6 +130,12 @@ pub fn new(node: i32) -> Result<Self> {
}
Ok(Self(node))
}
+
+ /// Returns the raw NUMA node identifier as an `i32`.
+ #[inline]
+ pub fn id(&self) -> i32 {
+ self.0
+ }
}
/// Specify necessary constant to pass the information to Allocator that the caller doesn't care
---
base-commit: 72d3fcf802c45d00b300f25b848a93c3a2bd7c7e
change-id: 20260608-numa-node-id-85de708d4e8d
Best regards,
--
Andreas Hindborg <a.hindborg@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] rust: alloc: add `NumaNode::id()` accessor
2026-09-29 15:18 [PATCH v2] rust: alloc: add `NumaNode::id()` accessor Andreas Hindborg
@ 2026-09-29 16:27 ` Gary Guo
2026-09-29 19:15 ` Danilo Krummrich
1 sibling, 0 replies; 3+ messages in thread
From: Gary Guo @ 2026-09-29 16:27 UTC (permalink / raw)
To: Andreas Hindborg, Danilo Krummrich, Lorenzo Stoakes,
Vlastimil Babka, Liam R. Howlett, Uladzislau Rezki, Miguel Ojeda,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Alice Ryhl, Trevor Gross, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan
Cc: rust-for-linux, linux-kernel
On Tue Sep 29, 2026 at 4:18 PM BST, Andreas Hindborg wrote:
> `NumaNode` wraps an `i32` but offers no way to read it back. Add a
> trivial `id()` getter so callers that need to pass the node id to a
> C binding can recover the underlying `c_int` without reaching into
> the private field.
>
> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
> ---
> Changes in v2:
> - Rebase on v7.3-rc5.
> - Add `#[inline]` attribute (Alice, Gary).
> - Link to v1: https://msgid.link/20260608-numa-node-id-v1-1-28480299c62d@kernel.org
> ---
> This will be used by an upcoming change that adds a home node parameter to
> the block layer `TagSet::new()` constructor.
> ---
> rust/kernel/alloc.rs | 6 ++++++
> 1 file changed, 6 insertions(+)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] rust: alloc: add `NumaNode::id()` accessor
2026-09-29 15:18 [PATCH v2] rust: alloc: add `NumaNode::id()` accessor Andreas Hindborg
2026-09-29 16:27 ` Gary Guo
@ 2026-09-29 19:15 ` Danilo Krummrich
1 sibling, 0 replies; 3+ messages in thread
From: Danilo Krummrich @ 2026-09-29 19:15 UTC (permalink / raw)
To: Andreas Hindborg
Cc: Danilo Krummrich, Lorenzo Stoakes, Vlastimil Babka,
Liam R . Howlett, Uladzislau Rezki, Miguel Ojeda, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Alice Ryhl,
Trevor Gross, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, rust-for-linux, linux-kernel
On Tue, 29 Sep 2026 17:18:24 +0200, Andreas Hindborg wrote:
> [PATCH v2] rust: alloc: add `NumaNode::id()` accessor
Applied, thanks!
Branch: alloc-next
Tree: git@github.com:Rust-for-Linux/linux.git
[1/1] rust: alloc: add `NumaNode::id()` accessor
commit: 6e8339118040
The patch will appear in the next linux-next integration (typically within 24
hours on weekdays).
The patch is queued up for the upcoming merge window for the next major kernel
release.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-29 19:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-29 15:18 [PATCH v2] rust: alloc: add `NumaNode::id()` accessor Andreas Hindborg
2026-09-29 16:27 ` Gary Guo
2026-09-29 19:15 ` Danilo Krummrich
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®