udev: add rules for scheduler tuning
This commit is contained in:
parent
4e9b48112d
commit
35b44f0b7f
3 changed files with 57 additions and 0 deletions
14
udev/80-tuned-iosched.rules
Normal file
14
udev/80-tuned-iosched.rules
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#
|
||||
# CFQ's default tunings are geared towards slow SATA disks. If we detect
|
||||
# anything else, we change the tunings to drive deeper queue depths and
|
||||
# keep the device busy.
|
||||
#
|
||||
SUBSYSTEM!="block", GOTO="end_iosched"
|
||||
KERNEL=="dm-*", GOTO="end_iosched"
|
||||
ENV{DEVTYPE}=="partition", GOTO="end_iosched"
|
||||
ACTION!="add|change", GOTO="end_iosched"
|
||||
ENV{ID_BUS}=="ata", GOTO="end_iosched"
|
||||
ATTR{queue/scheduler}!="*\[cfq\]", GOTO="end_iosched"
|
||||
ATTR{queue/iosched/slice_idle}="0"
|
||||
ATTR{queue/iosched/quantum}="32"
|
||||
LABEL="end_iosched"
|
||||
9
udev/80-tuned-mpath-iosched.rules
Normal file
9
udev/80-tuned-mpath-iosched.rules
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
SUBSYSTEM!="block", GOTO="end_mpath_iosched"
|
||||
ENV{DEVTYPE}=="partition", GOTO="end_mpath_iosched"
|
||||
KERNEL!="dm-*", GOTO="end_mpath_iosched"
|
||||
ACTION!="change", GOTO="end_mpath_iosched"
|
||||
ATTR{queue/scheduler}!="*\[cfq\]", GOTO="end_mpath_iosched"
|
||||
ENV{DM_UUID}!="mpath-?*", GOTO="end_mpath_iosched"
|
||||
ENV{DM_ACTION}=="PATH_FAILED", GOTO="end_mpath_iosched"
|
||||
RUN+="tuned-mpath-iosched.sh"
|
||||
LABEL="end_mpath_iosched"
|
||||
34
udev/tuned-mpath-iosched
Executable file
34
udev/tuned-mpath-iosched
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# For the request-based multipath driver, the I/O scheduler runs on the
|
||||
# multipath device, not the underlying "slave" devices. This script
|
||||
# checks the ID_BUS attribute for each of the slave devices. If it finds
|
||||
# an ata device, it leaves the I/O scheduler tunings alone. For any other
|
||||
# device, we tune the I/O scheduler to try to keep the device busy.
|
||||
#
|
||||
|
||||
if [ -z "$DEVPATH" ]; then
|
||||
logger "$0: DEVPATH is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d /sys/${DEVPATH}/slaves ]; then
|
||||
logger "$0: 'slaves' directory under '$DEVPATH' does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
needs_tuning=1
|
||||
for slave in $(command ls /sys/${DEVPATH}/slaves/* 2>/dev/null); do
|
||||
bus_type=$(/sbin/udevadm info --query=property --path=$slave | grep -m1 ID_BUS | cut -d= -2)
|
||||
if [ "$bus_type" = "ata" ]; then
|
||||
needs_tuning=0
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $needs_tuning -eq 1 ]; then
|
||||
echo 0 > /sys/${DEVPATH}/queue/iosched/slice_idle
|
||||
echo 32 > /sys/${DEVPATH}/queue/iosched/quantum
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Loading…
Reference in a new issue