SteamOS icon indicating copy to clipboard operation
SteamOS copied to clipboard

Consider switching to `Kyber` IO scheduler for SSDs, and `BFQ` for SD cards, to fix microstutters

Open ahydronous opened this issue 1 year ago • 7 comments

Currently SteamOS uses mq-deadline, which is suboptimal.

Although it seems very unlikely people are still gaming on HDDs, BFQ is also the best option there

Pop_OS did this specifically to fix microstutters and provide a better experience under load: https://github.com/pop-os/default-settings/commit/0636b6cb94a0d267387caa0b4f9370ce7e82640c

ahydronous avatar Aug 15 '24 16:08 ahydronous

For anyone considering automating this (until the SteamOS team sets it by default via udev rules): it is extremely annoying to do.

Because of SteamOS's immutable rootfs, you can only place unit files in ~/.config/systemd/user. These services cannot run privileged commands. Running commands with pkexec or calling a script that uses pkexec means you need to write a polkit rule. You can either do a generalized one (gaping security hole) or write a specific one which is just a huge pain.

So yeah, hopefully the SteamOS team implements this "natively".

ahydronous avatar Aug 19 '24 22:08 ahydronous

@ahydronous

Changing the I/O-scheduler on SteamOS is super-easy thanks to A.B.T.'s tweaks; in fact, it's just a single copy & paste operation.

Here, have a look for yourself:

https://medium.com/@a.b.t./here-are-some-possibly-useful-tweaks-for-steamos-on-the-steam-deck-fcb6b571b577#c9f3

Note that A.B.T. sets "Kyber" as the default I/O-scheduler for microSD cards as well, however you can change that to BFQ easily, if you wish so.

Personally, I have been using "Kyber" for both the internal SSD and a 1TB microSD card with great success!

Hope it helps you, too!

FanOfABT avatar Aug 20 '24 01:08 FanOfABT

@FanOfABT if I understand SteamOS’ its layout correctly, writing anything to / is useless, as anything on the rootfs (or rather, not in deck/home) gets wiped by an update? Or have I misunderstood

ahydronous avatar Aug 23 '24 13:08 ahydronous

If the SteamOS team reads this, it only requires a very minor change, setting

# BFQ is recommended for slow storage such as rotational block devices and SD cards.
ACTION=="add|change", SUBSYSTEM=="block", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"
ACTION=="add|change", SUBSYSTEM=="block", KERNEL=="mmcblk?", ATTR{queue/scheduler}="bfq"

# Kyber is recommended for faster storage such as NVME and SATA SSDs.
ACTION=="add|change", SUBSYSTEM=="block", ATTR{queue/rotational}=="0", KERNEL=="nvme?n?", ATTR{queue/scheduler}="kyber"
ACTION=="add|change", SUBSYSTEM=="block", ATTR{queue/rotational}=="0", KERNEL=="sd?", ATTR{queue/scheduler}="kyber"

in a rules file in /lib/udev/rules.d/

ahydronous avatar Aug 25 '24 12:08 ahydronous

@ahydronous

Told you that A.B.T. had all of this figured out about a year ago.

But don't expect Valve to take your advise, because other useful suggestions by A.B.T. such as setting a 1000 Hz Linux kernel tick by default still haven't been implemented, as you can see here:

https://github.com/ValveSoftware/SteamOS/issues/1522

FanOfABT avatar Aug 25 '24 15:08 FanOfABT

Hi, I won't comment about the I/O schedulers but I wanted to quickly point out a couple of things about udev rules:

First, you don't need to touch the root filesystem to add your own rules, you can put them in /etc/udev/rules.d/ which is always writable.

Second, if you're using SteamOS 3.6 beta you can keep those changes after an OS update with this (SteamOS 3.5 does not need it):

# echo '/etc/udev/rules.d/*.rules' > /etc/atomic-update.conf.d/udev-rules.conf

bertogg avatar Sep 12 '24 12:09 bertogg

Replying to https://github.com/ValveSoftware/SteamOS/issues/1601#issuecomment-2346185382

I mean you can also easily just edit the system files all you want. just run steamos-readonly disable in a terminal and then add the "open_root plasma 6" service to dolphin. then you can just right click any folder and select to open it as root allowing you to edit as much as you want. obviously do not do this if you do not know what you are doing.

deathblade201243 avatar Sep 14 '24 09:09 deathblade201243