queue_depth of the block device

Oleksii Kurochko inisider at gmail.com
Thu May 7 04:57:40 EDT 2020

Hi all,

I would like to understand how actually queue_depth parameter is set.
I need this information to understand how can I affect on nr_request
parameter from here
I have found that for my block device queue_depth is set equal to 1 so
nr_request is equal to 2 but before the patch 32825c45("blk-mq-sched: fix
performance regression of mq-deadline") was introduced it had been equal to
128 and because of nr_request is equal to 2 now it affects the performance
of read/write operations. When I switched it back to 128 it starts to work
as it was before.

Currently, I am looking for a driver where is q->tag_set->queue_depth
I found that for the block device is used sd driver using the next command:
udevadm info -a /dev/sdb
looking at parent device


So I decided to go sd_probe and try to understand how struct request_queue
*q from blk_mq_init_sched() function is gotten and from sd_probe() function
I can conclude that it is passed through (
device_add_disk() -> __device_add_disk() -> elevator_init_mq() ->
blk_mq_init_mq() using gd variable. The queue for gd variable is set here
https://elixir.bootlin.com/linux/latest/source/drivers/scsi/sd.c#L3360 so
we can see that is actually taken value from a scsi_device structure.

My question is how to find out a driver of a scsi_device? Am I correct that
queue_depth should be set somewhere in the scsci_device?

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20200507/98be7ca9/attachment.html>

More information about the Kernelnewbies mailing list