SakuraOS Wiki

Tuning defaults

Linux ships defaults that have to suit a database server, a phone and a laptop at once. SakuraOS is only ever a desktop, so the defaults can be set for one job instead of averaged across three.

Memory and writeback

The kernel decides how much dirty data to hold in memory before writing it out. The stock setting is a percentage of RAM, which on a machine with 64 GB means many gigabytes of unwritten data and a stall when it finally flushes. SakuraOS sets absolute limits instead.

SettingValueWhat it does
vm.dirty_bytes256 MBHard ceiling on unwritten data, so a flush is never a multi-second freeze.
vm.dirty_background_bytes64 MBStart writing out quietly well before the ceiling.
vm.dirty_writeback_centisecs15 sHow often the flusher wakes. Less often means fewer disk wake-ups on a laptop.
vm.vfs_cache_pressure50Keep directory and inode caches longer. A desktop revisits the same paths constantly.
vm.watermark_boost_factor0Disable a reclaim behaviour that causes stalls without helping an interactive workload.
vm.compaction_proactiveness0Do not spend CPU compacting memory in the background on a machine with a person waiting.
vm.page_lock_unfairness1Reduce the worst-case wait for a contended page, trading a little throughput for responsiveness.
kernel.nmi_watchdog0A debugging feature that costs a timer on every CPU and helps nobody on a desktop.
net.core.netdev_max_backlog4096A deeper queue before the network stack starts dropping on a fast link.
kernel.kptr_restrict2Hide kernel pointers from userspace. This one is hardening, not performance.

The I/O scheduler is chosen per drive

There is no single right scheduler, because the right answer depends on whether the device has to move a physical arm. A udev rule picks per device as it appears:

DeviceSchedulerWhy
Spinning diskbfqSeeking is expensive, so it is worth spending CPU ordering requests fairly.
SATA or USB SSDmq-deadlineCheap ordering with a latency bound, without BFQ's overhead.
NVMenoneThe device has its own deep queues. Scheduling in the kernel first only adds latency.

Compressed swap in RAM

zram-generator provides a compressed swap device in memory. When a machine runs short, pages are compressed rather than written to disk, which is far faster than any SSD and does not wear it.

The practical effect is that a laptop with 8 GB and a browser full of tabs stays usable instead of having something killed. It is not a substitute for memory, but it moves the point at which a machine becomes unpleasant.

These are defaults, not policy. Everything here is a plain file in /etc/sysctl.d and /etc/udev/rules.d. They are marked as configuration, so if you change them your changes survive updates rather than being overwritten.

The kernel is separate

Scheduling behaviour comes from the kernel itself rather than from these values. See Kernel.