Skip to content

Use the kyber I/O scheduler on real disks - #11653

Merged
dhh merged 2 commits into
quattrofrom
io-scheduler-kyber
Sep 13, 2026
Merged

dhh merged 2 commits into
quattrofrom
io-scheduler-kyber

Conversation

@dhh

@dhh dhh commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The kernel's default scheduler choice is none or mq-deadline depending on the device. Neither regulates latency once the device queue fills, so a large build, copy, or package upgrade can make the desktop sluggish while interactive reads wait behind a wall of writes.

Change

A package-owned udev rule in /etc/udev/rules.d sets kyber on nvme, sd, mmcblk, and vd whole disks at boot and on hot-plug. Partitions and zram are not matched. Zoned btrfs disks are still moved back to mq-deadline by the later 64-btrfs-zoned.rules.

Kyber keeps reads in their own queue and throttles the depth it submits to hold a 2ms read latency target, so reads keep flowing under heavy writes at low CPU cost. The trade is a possible small ceiling on peak throughput on very fast devices, which matters for a storage server chasing IOPS but not for a desktop. Users who want something else can override it with a later-numbered rule.

The rule applies to rotational disks and USB storage as well. If we'd rather keep those on the kernel default, adding ATTR{queue/rotational}=="0" to the match narrows it to SSDs.

Existing installs pick it up at the next boot, same as the zram/sysctl tuning. It needs no migration.

Verification

  • udevadm verify passes on the rule file.
  • Applied on an XPS 14 (SK hynix NVMe plus a SanDisk USB stick): udevadm test --action=change matches both disks, does not match their partitions or zram0, and the live trigger moved the disks from none / mq-deadline to kyber.
  • Reviewed with Codex. It caught that the first version's globs also matched partitions, which produced a harmless but noisy "Could not chase sysfs attribute" per partition at boot. Fixed by matching on DEVTYPE=="disk".
  • ./test/all: test/shell.d/config-test.sh and test/shell.d/locate-test.sh fail, same as on a clean quattro checkout, so they are unrelated.

🤖 Generated with Claude Code

dhh and others added 2 commits September 13, 2026 11:53
The kernel leaves NVMe on none and everything else on mq-deadline. Neither
bounds latency once the device queue fills, so a large build, copy, or
package upgrade can make the desktop sluggish while reads wait behind a
wall of writes.

Kyber keeps separate read and sync-write queues and throttles the depth it
submits to hit a 2ms read target, which keeps interactive reads flowing
under heavy writes at negligible CPU cost. The trade is a small ceiling on
peak throughput on very fast devices, which matters for a storage server
chasing IOPS but not for a desktop.

Ships as a package-owned udev rule in /etc so it applies at boot and on
hot-plug. Existing installs pick it up at the next boot. zram is left alone
since it has nothing to schedule.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
udev patterns are shell globs, so nvme[0-9]*n[0-9]* also matched every
partition. Partitions have no queue/scheduler, and udev logged a "Could not
chase sysfs attribute" for each one at boot. Restrict the match to
SUBSYSTEM block with DEVTYPE disk, which also keeps mmcblk boot areas and
NVMe multipath nodes out.

Reword the comment: kyber targets a read latency rather than bounding it,
and the kernel's default choice depends on the device rather than being a
fixed NVMe versus everything-else split.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@csfh

csfh commented Sep 13, 2026

Copy link
Copy Markdown
Member

This is a good change. It seems harmless to me.

@dhh
dhh marked this pull request as ready for review September 13, 2026 14:45
@dhh
dhh requested a review from ryanrhughes as a code owner September 13, 2026 14:45
@dhh
dhh merged commit 6a89a39 into quattro Sep 13, 2026
@dhh
dhh deleted the io-scheduler-kyber branch September 13, 2026 14:45
dhh added a commit to omacom/omarchy-pkgs that referenced this pull request Sep 13, 2026
omacom/omarchy#11653 added etc/udev/rules.d/60-omarchy-io-scheduler.rules. package() already ships the whole etc/ tree, so the rule lands on new installs with the next build; list it in backup= so pacman keeps a user's local edit of the rule across upgrades, like the other package-owned /etc drop-ins.


Claude-Session: https://claude.ai/code/session_01EqYNBv5cERVom2zox5epyE

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
@emirb emirb added this to the 4.5 milestone Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants