[PATCH 16/79] block: rust: allow specifying home node when constructing `TagSet`

Andreas Hindborg
2026-02-15T23:42:28Z

Add a `numa_node` parameter to `TagSet::new` to specify the home NUMA
node for tag set allocations. This allows drivers to optimize memory
placement for NUMA systems.

Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
---
drivers/block/rnull/rnull.rs | 5 ++++-
rust/kernel/block/mq.rs | 5 ++++-
rust/kernel/block/mq/tag_set.rs | 3 ++-
3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/block/rnull/rnull.rs b/drivers/block/rnull/rnull.rs
index 990dfcf95c9de..278f75d886fd9 100644
--- a/drivers/block/rnull/rnull.rs
+++ b/drivers/block/rnull/rnull.rs
@@ -176,7 +176,10 @@ fn new(options: NullBlkOptions<'_>) -> Result<GenDisk<Self>> {
mq::tag_set::Flags::default()
};

- let tagset = Arc::pin_init(TagSet::new(submit_queues, 256, 1, flags), GFP_KERNEL)?;
+ let tagset = Arc::pin_init(
+ TagSet::new(submit_queues, 256, 1, bindings::NUMA_NO_NODE, flags),
+ GFP_KERNEL,
+ )?;

let queue_data = Box::pin_init(
pin_init!(QueueData {
diff --git a/rust/kernel/block/mq.rs b/rust/kernel/block/mq.rs
index 76e790cdb1f8f..d3957f2fb1a66 100644
--- a/rust/kernel/block/mq.rs
+++ b/rust/kernel/block/mq.rs
@@ -57,6 +57,7 @@
//!
//! ```rust
//! use kernel::{
+//! bindings,
//! block::mq::{self, *},
//! new_mutex,
//! prelude::*,
@@ -92,7 +93,9 @@
//! }
//!
//! let tagset: Arc<TagSet<MyBlkDevice>> =
-//! Arc::pin_init(TagSet::new(1, 256, 1, mq::tag_set::Flags::default()), GFP_KERNEL)?;
+//! Arc::pin_init(
+//! TagSet::new(1, 256, 1, bindings::NUMA_NO_NODE, mq::tag_set::Flags::default()),
+//! GFP_KERNEL)?;
//! let mut disk = gen_disk::GenDiskBuilder::new()
//! .capacity_sectors(4096)
//! .build(fmt!("myblk"), tagset, ())?;
diff --git a/rust/kernel/block/mq/tag_set.rs b/rust/kernel/block/mq/tag_set.rs
index af214f7dd0c10..e9b36d6329b9b 100644
--- a/rust/kernel/block/mq/tag_set.rs
+++ b/rust/kernel/block/mq/tag_set.rs
@@ -41,6 +41,7 @@ pub fn new(
nr_hw_queues: u32,
num_tags: u32,
num_maps: u32,
+ numa_node: i32,
flags: Flags,
) -> impl PinInit<Self, error::Error> {
// SAFETY: `blk_mq_tag_set` only contains integers and pointers, which
@@ -53,7 +54,7 @@ pub fn new(
ops: OperationsVTable::<T>::build(),
nr_hw_queues,
timeout: 0, // 0 means default which is 30Hz in C
- numa_node: bindings::NUMA_NO_NODE,
+ numa_node,
queue_depth: num_tags,
cmd_size,
flags: flags.into_inner(),

--
2.51.2