Setting the queue depth

6.10 LPAR mode z/VM guest

The Linux® SCSI code automatically adjusts the queue depth as necessary. Changing the queue depth is usually a storage server requirement.

Before you begin

Check the documentation of the storage server that is used or contact your storage server support group to establish if there is a need to change this setting.
The following information applies only to the SCSI layer. For block devices, such as SCSI disks, there is also a limit in the Linux block layer. To display the block device limit, issue:
# cat /sys/bus/scsi/devices/<scsi_device_name>/block/*/queue/nr_requests
Alternatively, issue:
# cat /sys/block/sd<X>/queue/nr_requests
The smaller of SCSI device queue_depth and block device nr_requests is the effective setting. For more details about block device requests, see www.kernel.org/doc/html/latest/block/queue-sysfs.html#nr-requests-rw and www.kernel.org/doc/html/latest/block/stat.html#in-flight.

About this task

The value of the zfcp.queue_depth kernel parameter or the queue_depth sysfs attribute is used as the maximum queue depth of new SCSI devices. You can query the queue depth by issuing a command of this form:
# cat /sys/bus/scsi/devices/<SCSI device>/queue_depth
Example:
# cat /sys/bus/scsi/devices/0:0:19:1086537744/queue_depth
16
You can change the maximum queue depth of each SCSI device by writing to the queue_depth attribute, for example:
# echo 8 > /sys/bus/scsi/devices/0:0:19:1086537744/queue_depth
# cat /sys/bus/scsi/devices/0:0:19:1086537744/queue_depth
8
This method is useful on a running system where you want to make dynamic changes. If you want to make the changes persistent across IPLs, you can:
  • Use the module parameter queue_depth or its associated kernel parameter described in zfcp device driver kernel parameters.
  • Write a udev rule to change the setting for each new SCSI device.
  • Use the appropriate tool or configuration file that is provided by your distribution.
Linux forwards SCSI commands to the storage server until the number of pending commands exceeds the queue depth. If the server lacks the resources to process a SCSI command, Linux queues the command for a later retry and decreases the queue depth counter. Linux then waits for a defined ramp-up period. If no indications of resource problems occur within this period, Linux increases the queue depth counter until reaching the previously set maximum value. To query the current value for the queue ramp-up period in milliseconds:
# cat /sys/bus/scsi/devices/0:0:13:1086537744/queue_ramp_up_period
120000
To set a new value for the queue ramp-up period in milliseconds:
# echo 1000 > /sys/bus/scsi/devices/0:0:13:1086537744/queue_ramp_up_period