Re: [PATCH 15/79] block: rnull: add `use_per_node_hctx` config option
From: Andreas Hindborg
Date: Mon Mar 16 2026 - 09:58:18 EST
"Alice Ryhl" <aliceryhl@xxxxxxxxxx> writes:
> On Mon, Feb 16, 2026 at 12:35:02AM +0100, Andreas Hindborg wrote:
>> Add a configfs attribute to enable per-NUMA-node hardware contexts.
>> When enabled, the driver creates one hardware queue per NUMA node
>> instead of the default configuration.
>>
>> Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
>
> This and other patches make me think that module parameters should have
> value() return a copy of the value (and require Copy). For non-copy
> types, there can be a separate value_ref() method. You would avoid *so*
> many asterisks by doing that.
Makes sense, I'll send a patch.
>
>> +configfs_attribute!(DeviceConfig, 8,
>> + show: |this, page| show_field(
>> + this.data.lock().submit_queues == kernel::num_online_nodes(), page
>> + ),
>> + store: |this, page| store_with_power_check(this, page, |this, page| {
>> + let value = core::str::from_utf8(page)?
>> + .trim()
>> + .parse::<u8>()
>> + .map_err(|_| kernel::error::code::EINVAL)?
>> + != 0;
>> +
>> + if value {
>> + this.data.lock().submit_queues *= kernel::num_online_nodes();
>> + }
>
> kstrtobool again. Also, this is *multiplying* the existing submit_queues
> value by the number of NUMA nodes?
Yea, that is not right. Astrisk should be deref on the other side of the
left hand expression.
>
>> + use_per_node_hctx: u8 {
>> + default: 0,
>> + description:
>> + "Use per-node allocation for hardware context queues, 0-false, 1-true. Default: 0-false",
>> + },
>
> formatting (rustfmt ignores macros)
This is intentional. The line gets too long if I pull it up, and I don't
think I can break the string in any way. I think it would require
changes to the module parameter macro.
Best regards,
Andreas Hindborg