File 60-io-scheduler.rules of Package systemd.21734

# Set optimal IO schedulers for HDD and SSD
# Copyright (c) 2021 SUSE LLC

# ## DO NOT EDIT. ##
# To modify the rules, copy this file to /etc/udev/rules.d/60-io-scheduler.rules
# and edit the copy.
# Please read the section "Tuning I/O performance" in the System Analysis and Tuning Guide
# from the SUSE Documentation.

# --- DO NOT EDIT THIS PART ----
SUBSYSTEM!="block", GOTO="scheduler_end"
ACTION!="add|change", GOTO="scheduler_end"
ENV{DEVTYPE}!="disk", GOTO="scheduler_end"

# For dm devices, the relevant events are "change" events, see 10-dm.rules
ACTION!="change", KERNEL=="dm-*", GOTO="scheduler_end"
# "none" with no brackets means scheduler isn't configurable
ATTR{queue/scheduler}=="none", GOTO="scheduler_end"
# keep our hands off zoned devices, the kernel auto-configures them
ATTR{queue/zoned}!="none", GOTO="scheduler_end"

# --- EDIT BELOW HERE after copying to /etc/udev/rules.d ---

# Determine if BLK-MQ is enabled
TEST=="%S%p/mq", GOTO="mq_scheduler"

##### rules for Non-MQ #####
# Enforce "noop" for multipath components.
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ATTR{queue/scheduler}="noop", GOTO="scheduler_end"

# Do not change scheduler if `elevator` cmdline parameter is set
IMPORT{cmdline}="elevator"
ENV{elevator}=="?*", GOTO="scheduler_end"

# CFQ scheduler for HDD
ATTR{queue/rotational}!="0", ATTR{queue/scheduler}="cfq"
# deadline scheduler for SSD
ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"

GOTO="scheduler_end"

#####   rules for MQ   #####
LABEL="mq_scheduler"
# Enforce "none" for multipath components.
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ATTR{queue/scheduler}="none", GOTO="scheduler_end"

# 1. BFQ scheduler for single-queue HDD
ATTR{queue/rotational}!="0", TEST!="%S%p/mq/1", ATTR{queue/scheduler}="bfq", GOTO="scheduler_end"

# 2. BFQ scheduler for every HDD, including "real" multiqueue
# ATTR{queue/rotational}!="0", ATTR{queue/scheduler}="bfq", GOTO="scheduler_end"

# 3. For "real" multiqueue devices, the kernel defaults to no IO scheduling
# Uncomment this (and select your scheduler) if you need an IO scheduler for them
# TEST=="%S%p/mq/1", ATTR{queue/scheduler}="kyber", GOTO="scheduler_end"

# 4. BFQ scheduler for every device (uncomment if you need ionice or blk-cgroup features)
# ATTR{queue/scheduler}="bfq", GOTO="scheduler_end"

# 5. mq-deadline is the kernel default for devices with just one hardware queue
# ATTR{queue/scheduler}="mq-deadline"

# --- EDIT ABOVE HERE after copying to /etc/udev/rules.d ---
LABEL="scheduler_end"
openSUSE Build Service is sponsored by