Re: [PATCH v10 10/13] blk-mq: use hk cpus only when isolcpus=io_queue is enabled

Aaron Tomlin
2026-04-05T23:09:46Z

[-- Attachment #1: Type: text/plain, Size: 1079 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]