diff --git a/60-io-scheduler.rules b/60-io-scheduler.rules new file mode 100644 index 00000000..1753c95f --- /dev/null +++ b/60-io-scheduler.rules @@ -0,0 +1,24 @@ +# Set optimal IO schedulers for HDD and SSD + +ACTION!="add", GOTO="scheduler_end" +SUBSYSTEM!="block", GOTO="scheduler_end" + +# Do not change scheduler if `elevator` cmdline parameter is set +IMPORT{cmdline}="elevator" +ENV{elevator}=="*?", GOTO="scheduler_end" + +# Determine if BLK-MQ is enabled +TEST=="%S%p/mq", ENV{.IS_MQ}="1" + +# MQ: BFQ scheduler for HDD +ENV{.IS_MQ}=="1", ATTR{queue/rotational}!="0", ATTR{queue/scheduler}="bfq" +# MQ: deadline scheduler for SSD +ENV{.IS_MQ}=="1", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="mq-deadline" + +# Non-MQ: CFQ scheduler for HDD +ENV{.IS_MQ}!="1", ATTR{queue/rotational}!="0", ATTR{queue/scheduler}="cfq" +# Non-MQ: deadline scheduler for SSD +ENV{.IS_MQ}!="1", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline" + +LABEL="scheduler_end" + diff --git a/60-ssd-scheduler.rules b/60-ssd-scheduler.rules deleted file mode 100644 index 43aa8ea7..00000000 --- a/60-ssd-scheduler.rules +++ /dev/null @@ -1,11 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION!="add", GOTO="ssd_scheduler_end" -SUBSYSTEM!="block", GOTO="ssd_scheduler_end" - -IMPORT{cmdline}="elevator" -ENV{elevator}=="*?", GOTO="ssd_scheduler_end" - -KERNEL=="sd*[!0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline" - -LABEL="ssd_scheduler_end" diff --git a/systemd-mini.changes b/systemd-mini.changes index 05c02977..f3aa511f 100644 --- a/systemd-mini.changes +++ b/systemd-mini.changes @@ -62,6 +62,18 @@ Wed Mar 28 11:58:10 UTC 2018 - fbui@suse.com - Split systemd-coredump sub-package off (bsc#1083849) +------------------------------------------------------------------- +Tue Mar 27 20:15:06 UTC 2018 - develop7@develop7.info + +- Enhance IO scheduler tweaking rules to support blk-mq as well + + * Set optimal blk-mq schedulers (bfq and mq-deadline for HDD and + SSD respectively) + * Explicitly set CFQ for rotational disks when no `elevator` + is specified + * Verbose comments explaining what is going on + * Rename the rules file since it is not ssd-only anymore + ------------------------------------------------------------------- Tue Mar 27 15:58:34 UTC 2018 - fbui@suse.com diff --git a/systemd-mini.spec b/systemd-mini.spec index c403fbd4..69250b6f 100644 --- a/systemd-mini.spec +++ b/systemd-mini.spec @@ -152,7 +152,7 @@ Source101: scripts-systemd-upgrade-from-pre-210.sh Source102: scripts-systemd-migrate-sysconfig-i18n.sh Source200: scripts-udev-convert-lib-udev-path.sh -Source1000: 60-ssd-scheduler.rules +Source1000: 60-io-scheduler.rules Source1001: 80-hotplug-cpu-mem.rules Source1002: 99-wakeup-from-idle.rules @@ -497,7 +497,7 @@ install -m0755 -D %{S:3} %{buildroot}/%{_sbindir}/systemd-sysv-convert install -m0755 -D %{S:12} %{buildroot}/%{_prefix}/lib/systemd/systemd-sysv-install # The rules that we shouldn't maintain -install -m0644 -D %{S:1000} %{buildroot}%{_udevrulesdir}/60-ssd-scheduler.rules +install -m0644 -D %{S:1000} %{buildroot}%{_udevrulesdir}/60-io-scheduler.rules install -m0644 -D %{S:1001} %{buildroot}%{_udevrulesdir}/80-hotplug-cpu-mem.rules install -m0644 -D %{S:1002} %{buildroot}%{_udevrulesdir}/99-wakeup-from-idle.rules diff --git a/systemd.changes b/systemd.changes index 05c02977..21cf6571 100644 --- a/systemd.changes +++ b/systemd.changes @@ -62,6 +62,18 @@ Wed Mar 28 11:58:10 UTC 2018 - fbui@suse.com - Split systemd-coredump sub-package off (bsc#1083849) +------------------------------------------------------------------- +Tue Mar 27 20:14:41 UTC 2018 - develop7@develop7.info + +- Enhance IO scheduler tweaking rules to support blk-mq as well + + * Set optimal blk-mq schedulers (bfq and mq-deadline for HDD and + SSD respectively) + * Explicitly set CFQ for rotational disks when no `elevator` + is specified + * Verbose comments explaining what is going on + * Rename the rules file since it is not ssd-only anymore + ------------------------------------------------------------------- Tue Mar 27 15:58:34 UTC 2018 - fbui@suse.com diff --git a/systemd.spec b/systemd.spec index 6a62e0c1..8c0cf8dd 100644 --- a/systemd.spec +++ b/systemd.spec @@ -150,7 +150,7 @@ Source101: scripts-systemd-upgrade-from-pre-210.sh Source102: scripts-systemd-migrate-sysconfig-i18n.sh Source200: scripts-udev-convert-lib-udev-path.sh -Source1000: 60-ssd-scheduler.rules +Source1000: 60-io-scheduler.rules Source1001: 80-hotplug-cpu-mem.rules Source1002: 99-wakeup-from-idle.rules @@ -495,7 +495,7 @@ install -m0755 -D %{S:3} %{buildroot}/%{_sbindir}/systemd-sysv-convert install -m0755 -D %{S:12} %{buildroot}/%{_prefix}/lib/systemd/systemd-sysv-install # The rules that we shouldn't maintain -install -m0644 -D %{S:1000} %{buildroot}%{_udevrulesdir}/60-ssd-scheduler.rules +install -m0644 -D %{S:1000} %{buildroot}%{_udevrulesdir}/60-io-scheduler.rules install -m0644 -D %{S:1001} %{buildroot}%{_udevrulesdir}/80-hotplug-cpu-mem.rules install -m0644 -D %{S:1002} %{buildroot}%{_udevrulesdir}/99-wakeup-from-idle.rules