chore: updated guide with more custom nice rules

This commit is contained in:
Bastian de Byl
2026-01-04 14:47:31 -05:00
parent ce6efb61f0
commit b8fb241e84

View File

@@ -195,7 +195,8 @@ yay -S cachyos-ananicy-rules-git # Community rules
sudo systemctl enable --now ananicy-cpp
```
Now add custom rules for package management and compilation:
Now add custom rules. First, demote background tasks that shouldn't freeze your
desktop:
```bash
sudo tee /etc/ananicy.d/package-managers.rules << 'EOF'
@@ -212,12 +213,40 @@ sudo tee /etc/ananicy.d/package-managers.rules << 'EOF'
{"name": "cargo", "type": "BG_CPUIO"}
{"name": "ninja", "type": "BG_CPUIO"}
{"name": "make", "type": "BG_CPUIO"}
# Coredump processing - can churn through 100MB+ dumps
{"name": "systemd-coredump", "type": "BG_CPUIO"}
{"name": "coredumpctl", "type": "BG_CPUIO"}
EOF
```
The `BG_CPUIO` type sets `nice=16`, `ioclass=idle`, and `sched=idle`. These
processes will only get CPU and disk time when nothing else needs it.
Next, boost interactive desktop applications that need to stay responsive:
```bash
sudo tee /etc/ananicy.d/99-desktop-priority.rules << 'EOF'
# Desktop apps that need high priority for responsiveness
# Terminal emulators
{"name": "warp", "type": "LowLatency_RT"}
{"name": "kitty", "type": "LowLatency_RT"}
{"name": "alacritty", "type": "LowLatency_RT"}
# Plasma desktop - boost higher than defaults
{"name": "plasmashell", "nice": -5, "ioclass": "best-effort", "ionice": 0, "latency_nice": -5}
# Browsers - boost for snappier UI
{"name": "vivaldi-bin", "nice": -3, "ioclass": "best-effort", "ionice": 2, "latency_nice": -3}
{"name": "firefox", "nice": -3, "ioclass": "best-effort", "ionice": 2, "latency_nice": -3}
EOF
```
The `LowLatency_RT` type sets `nice=-12` — these apps get CPU priority over
almost everything else. The `99-` prefix ensures this file loads last and
overrides any conflicting defaults.
## Step 5: Tune VM Dirty Page Handling
The kernel's default dirty page settings are tuned for servers, not desktops.
@@ -259,10 +288,24 @@ sudo sysctl --system
| 1.2GB ClamAV RAM usage | 0 bytes |
| BFQ overhead on NVMe | Direct hardware scheduling |
| Compilation starves desktop | Compilation yields to UI |
| Coredump processing freezes system | Runs at idle priority |
| All processes equal priority | Desktop apps prioritized |
The final priority hierarchy looks like this:
| Process | Nice | Notes |
|:--------|-----:|:------|
| warp, kitty, kwin | -12 | `LowLatency_RT` — always responsive |
| plasmashell | -5 | Boosted from default -1 |
| vivaldi, firefox | -3 | Snappier than default |
| _normal processes_ | 0 | Default |
| pacman, dkms, gcc | +16 | `BG_CPUIO` — idle only |
| systemd-coredump | +16 | Won't freeze on crash dumps |
DKMS can now compile nvidia modules while I continue working. Package updates
run in the background without the mouse cursor freezing. The system finally
behaves like it should on modern hardware.
run in the background without the mouse cursor freezing. Even when an app
crashes and generates a 100MB+ coredump, the desktop stays smooth. The system
finally behaves like it should on modern hardware.
# Diagnostic Commands