Re: [PATCH RFC v7 10/12] megaraid_sas: switch fusion adapters to MQ

Ming Lei
2020-07-24T02:47:30Z

On Thu, Jul 23, 2020 at 06:29:01PM +0100, John Garry wrote:
> > > As I see, since megaraid will have 1:1 mapping of CPU to hw queue, will
> > > there only ever possibly a single bit set in ctx_map? If so, it seems a
> > > waste to always check every sbitmap map. But adding logic for this may
> > > negate any possible gains.
> >
> > It really depends on min and max cpu id in the map, then sbitmap
> > depth can be reduced to (max - min + 1). I'd suggest to double check that
> > cost of sbitmap_any_bit_set() really matters.
>
> Hi Ming,
>
> I'm not sure that reducing the search range would help much, as we still
> need to load some indexes of map[], and at best this may be reduced from 2/3
> -> 1 elements, depending on nr_cpus.

I believe you misunderstood my idea, and you have to think it from implementation
viewpoint.

The only workable way is to store the min cpu id as 'offset' and set the sbitmap
depth as (max - min + 1), isn't it? Then the actual cpu id can be figured out via
'offset' + nr_bit. And the whole indexes are just spread on the actual depth. BTW,
max & min is the max / min cpu id in hctx->cpu_map. So we can improve not only on 1:1,
and I guess most of MQ cases can benefit from the change, since it shouldn't be usual
for one ctx_map to cover both 0 & nr_cpu_id - 1.

Meantime, we need to allocate the sbitmap dynamically.

Thanks,
Ming