Re: Regarding patch "block/blk-mq: Don't complete locally if capacities are different"

Christian Loehle
2024-08-02T09:03:22Z

On 7/31/24 14:46, MANISH PANDEY wrote:
> Hi Qais Yousef,

Qais already asked the important question, still some from my end.

> Recently we observed below patch has been merged
> https://lore.kernel.org/all/20240223155749.2958009-3-qyousef@layalina.io
>
> This patch is causing performance degradation ~20% in Random IO along with significant drop in Sequential IO performance. So we would like to revert this patch as it impacts MCQ UFS devices heavily. Though Non MCQ devices are also getting impacted due to this.

I'm curious about the sequential IO part in particular, what's the blocksize and throughput?
If blocksize is large enough the completion and submission parts are hopefully not as critical.

>
> We have several concerns with the patch
> 1. This patch takes away the luxury of affining best possible cpus from   device drivers and limits driver to fall in same group of CPUs.
>
> 2. Why can't device driver use irq affinity to use desired CPUs to complete the IO request, instead of forcing it from block layer.
>
> 3. Already CPUs are grouped based on LLC, then if a new categorization is required ?

As Qais hinted at, because of systems that share LLC on all CPUs but are HMP.

>
>> big performance impact if the IO request
>> was done from a CPU with higher capacity but the interrupt is serviced
>> on a lower capacity CPU.
>
> This patch doesn't considers the issue of contention in submission path and completion path. Also what if we want to complete the request of smaller capacity CPU to Higher capacity CPU?
> Shouldn't a device driver take care of this and allow the vendors to use the best possible combination they want to use?
> Does it considers MCQ devices and different SQ<->CQ mappings?

So I'm assuming you're seeing something like the following:
Some CPU(s) (call them S) are submitting IO, hardirq triggers on
S.
Before the patch the completion softirq could run on a !S CPU,
now it runs on S. Am I then correct in assuming your workload
is CPU-bound on S? Would you share some details about the
workload, too?

What's the capacity of CPU(s) S then?
IOW does this help?

-->8--

diff --git a/block/blk-mq.c b/block/blk-mq.c
index e3c3c0c21b55..a4a2500c4ef6 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1164,7 +1164,7 @@ static inline bool blk_mq_complete_need_ipi(struct request *rq)
if (cpu == rq->mq_ctx->cpu ||
(!test_bit(QUEUE_FLAG_SAME_FORCE, &rq->q->queue_flags) &&
cpus_share_cache(cpu, rq->mq_ctx->cpu) &&
- cpus_equal_capacity(cpu, rq->mq_ctx->cpu)))
+ arch_scale_cpu_capacity(cpu) >= arch_scale_cpu_capacity(rq->mq_ctx->cpu)))
return false;

/* don't try to IPI to an offline CPU */