[PATCH v10 10/13] blk-mq: use hk cpus only when isolcpus=io_queue is enabled
Aaron Tomlin
atomlin at atomlin.com
Sun Apr 5 16:09:36 PDT 2026
On Thu, Apr 02, 2026 at 10:06:51PM -0400, Waiman Long wrote:
> > diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c
> > index 8244ecf87835..8d09af49a142 100644
> > --- a/block/blk-mq-cpumap.c
> > +++ b/block/blk-mq-cpumap.c
> > @@ -22,7 +22,18 @@ static unsigned int blk_mq_num_queues(const struct cpumask *mask,
> > {
> > unsigned int num;
> > - num = cpumask_weight(mask);
> > + if (housekeeping_enabled(HK_TYPE_IO_QUEUE)) {
> > + const struct cpumask *hk_mask;
> > + struct cpumask avail_mask;
> > +
> > + hk_mask = housekeeping_cpumask(HK_TYPE_IO_QUEUE);
> > + cpumask_and(&avail_mask, mask, hk_mask);
> > +
> > + num = cpumask_weight(&avail_mask);
>
> As said before by Ming Lei, struct cpumask can be rather big in size if
> NR_CPUS is large. I will suggest using cpumask_weight_and() instead which
> will eliminate the need of the local variables.
Hi Longman,
I agree. Also, it perfectly circumvents the need for the temporary local
mask while achieving the exact same intersection count.
Kind regards,
--
Aaron Tomlin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-nvme/attachments/20260405/5cad6d4c/attachment-0001.sig>
More information about the Linux-nvme
mailing list