Re: [PATCH RFC] scsi: core: remove unsed 'restarts' from scsi_device

From: Yu Kuai
Date: Sun Nov 27 2022 - 21:49:55 EST


Hi, Ming

在 2022/11/27 17:45, Ming Lei 写道:
On Sat, Nov 26, 2022 at 04:54:46PM +0800, Yu Kuai wrote:
Hi,

在 2022/11/18 19:30, Yu Kuai 写道:
From: Yu Kuai <yukuai3@xxxxxxxxxx>

During code review, I found that 'restarts' is not useful anymore after
the following commits:

1) commit ab3cee3762e5 ("blk-mq: In blk_mq_dispatch_rq_list() "no budget"
is a reason to kick")
2) commit d3b38596875d ("blk-mq: run queue no matter whether the request
is the last request")
3) commit 673235f91531 ("scsi: core: Fix race between handling STS_RESOURCE
and completion")

Now that if get budget ever failed, block layer will make sure to
trigger new run queue for the hctx. Hence there is no need to run queue
from scsi layer in this case.


Does anyone has suggestions about this patch?

More info why I tried to remove this:

while testing megaraid with 4 nvme with none elevator, the default
queue_depth is 128, while I test it with fio 128 jobs and 1 iodepth,
bw is about 4Gib/s, however, if I test with 128 jobs and 2 iodepth,
bw is decreased to about 0.8Gib/s, and with this patch applied,
bw can stay 4Gib/s in the later case.

I will look at this patch next week.

Can you investigate a bit the reason why perf boost is from this patch?

test cmd:

without this patch, perf will show that on cpu time is wasted on
mod_delayed_work_on:

- 3.44% swapper [kernel.vmlinux] [k] mod_delayed_work_on
- mod_delayed_work_on
- 3.44% kblockd_mod_delayed_work_on
__blk_mq_delay_run_hw_queue
scsi_run_queue_async
scsi_end_request
scsi_io_completion
scsi_finish_command
+ scsi_complete
+ 1.05% ksoftirqd/30 [kernel.vmlinux] [k] mod_delayed_work_on
+ 0.54% fio [kernel.vmlinux] [k] mod_delayed_work_on
0.36% ksoftirqd/22 [kernel.vmlinux] [k] mod_delayed_work_on
0.35% ksoftirqd/1 [kernel.vmlinux] [k] mod_delayed_work_on

I also attched the flamegraph.

Thanks,
Kuai

o> Thanks,
Ming


.

Attachment: 6.1.0-rc6.svg
Description: image/svg

Attachment: 6.1.0-rc6-patched.svg
Description: image/svg