[PATCH v8 10/12] blk-mq: use hk cpus only when isolcpus=io_queue is enabled
Daniel Wagner
dwagner at suse.de
Mon Sep 8 00:36:34 PDT 2025
On Fri, Sep 05, 2025 at 04:59:56PM +0200, Daniel Wagner wrote:
> void blk_mq_map_queues(struct blk_mq_queue_map *qmap)
> {
> - const struct cpumask *masks;
> + struct cpumask *masks __free(kfree) = NULL;
> + const struct cpumask *constraint;
> unsigned int queue, cpu, nr_masks;
> + cpumask_var_t active_hctx;
>
> + if (!zalloc_cpumask_var(&active_hctx, GFP_KERNEL))
> + goto fallback;
> +
> + free_cpumask_var(active_hctx);
> +
> + return;
> +
> +free_fallback:
> + free_cpumask_var(active_hctx);
> +
> +fallback:
> + blk_mq_map_fallback(qmap);
I am not so happy that the cpumask_var_t and __free doesn't work to
together at this point due to the 'evil way' how cpumask_var_t is defined:
ifdef CONFIG_CPUMASK_OFFSTACK
typedef struct cpumask *cpumask_var_t;
#else
typedef struct cpumask cpumask_var_t[1];
#endif /* CONFIG_CPUMASK_OFFSTACK */
In the previous version I used
cpumask_var_t active_hctx __free(free_cpumask_var) = NULL;
which resulted in a way cleaner code. Though the kernel test robot
complained with
>> block/blk-mq-cpumap.c:155:16: error: array initializer must be an initializer list
155 | cpumask_var_t active_hctx __free(free_cpumask_var) = NULL;
I try to figure out if it's possible to get this somehow working with
some witchcraft (aka pre compiler magic).
More information about the Linux-nvme
mailing list