Repository navigation
Conversation
…nput Hyprland, the shell, PipeWire, the portals and D-Bus all run in session.slice. Everything the user launches lands in app.slice: browsers, terminals, and whatever those terminals start. Both slices ship at cpu.weight=100, so when a couple of builds pin every core the compositor's input loop waits its turn like any compiler thread. libinput then logs "event processing lagging behind by N ms, your system is too slow", the pointer stutters, and key events queue up until the scheduler comes back around. Ship /usr/lib/systemd/user/session.slice.d/10-cpuweight.conf with CPUWeight=1000. Weight only arbitrates under contention, so an idle machine is unchanged and builds still get every core the compositor is not using at that instant. A migration reloads the user manager so existing sessions pick it up live. Tests assert the drop-in, that only session.slice is weighted, and that the migration reloads.
There was a problem hiding this comment.
Pull request overview
Prioritizes interactive session processes over app workloads during CPU contention. Packaging must be coordinated before release so the migration reloads an installed drop-in.
Changes:
- Sets
session.sliceCPU weight to 1000. - Reloads existing user managers through a migration.
- Adds documentation and regression checks.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
default/systemd/user/session.slice.d/10-cpuweight.conf |
Defines the session CPU weight. |
migrations/1787276689.sh |
Reloads the user systemd manager. |
test/shell.d/systemd-test.sh |
Checks weighting and migration behavior. |
docs/file-layout.md |
Documents the installed drop-in path. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # New installs get /usr/lib/systemd/user/session.slice.d/10-cpuweight.conf | ||
| # with the package. Existing sessions only apply a slice drop-in when the user | ||
| # manager reloads, and the weight takes effect live -- no relogin needed. |
…there yet Migrations run once. If this lands before omarchy-settings ships session.slice.d/10-cpuweight.conf, the daemon-reload has nothing to pick up and the user waits for a relogin. Fall back to a --runtime set-property for the current session; the packaged file takes over at the next login. config-test now requires the PKGBUILD to install the drop-in, coupling the two releases.
|
Addressed the packaging-order point:
|
|
Reviewed on a disposable Omarchy VM with a live Hyprland session, plus an independent Verified on the machine, not just read:
Two written claims that do not hold. Neither changes behaviour, so I have not touched your branch:
Merge order, which is the maintainer's call. Copilot's earlier note about the migration completing before the drop-in exists is answered by the Nothing pushed. Waiting on the maintainer for the merge-order decision; nothing outstanding for you. Second opinion: codex at xhigh agreed on the delegation, the slice placement, the |
Review on omacom#7651 caught two claims that do not hold. A user manager is per user, not per session, so an update from SSH or a TTY does reload the graphical session's manager -- the same sentence was inherited from the oomd migration, so correct it there too. And --runtime is not "nothing persists": it writes a drop-in under /run/user/$UID/systemd/user.control that outranks the packaged file for as long as that manager lives. Both values are 1000 today, so behaviour is unchanged; only the comments are.
|
Addressed the two wording points from the review in 255e881 (comments only, no behaviour change):
|
Two of the new assertions passed against a change that does nothing. Appending a second `CPUWeight=100` to the drop-in left the file with an effective weight of 100 -- systemd takes the last assignment -- while a match-anywhere grep still found the 1000 above it, and the same-file exclusion in the stray-weight check meant nothing else looked at it either. Commenting out both `systemctl` calls in the migration reduced it to a file of comments, and all three migration assertions still passed, because a substring grep matches a commented line as readily as a live one. The weight check now compares the last `CPUWeight=` line against 1000, and the migration checks anchor to the start of a line. The stray-weight check drops its `grep -q` terminator for a captured variable, which reports the offending path in the failure and removes the case where `grep -q` closing the pipe early turns a real violation into a SIGPIPE status that `pipefail` reads as no violation. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Codex XHigh <noreply@openai.com>
|
Reviewed with Opus 5 in Claude Code alongside an independent second opinion from Codex at xhigh effort. Every finding below was checked against the source, and every systemd claim against a live Omarchy session, rather than taken on either model's word. One commit is pushed to this branch — The diagnosis holds up, and it reproduces. The drop-in is never installed, and the migration hides that. A file under The packaging half is now open as a draft at omacom/omarchy-pkgs#191, against both the stable and the dev recipe — Two of the four new assertions passed against a migration that does nothing. Appending a second A stock keybind puts a CPU-heavy encoder inside the slice being boosted. So Scope worth naming rather than fixing. The weight only arbitrates inside One accuracy point for the description. It says both slices "ship at systemd's default |
The weight assertion matched `^CPUWeight=` anywhere in the drop-in, so a file whose effective weight is 100 passed: `[Slice] CPUWeight=100` followed by `[Unit] CPUWeight=1000` is green, and systemd reports `CPUWeight=100` with `cpu.weight=100` for it on a live session. A drop-in with no `[Slice]` section at all passed the same way. Both are the case the previous assertion was written to close, one section over. The migration greps had no right-hand boundary, so `CPUWeight=10000` in the migration satisfied a check for 1000 while the drop-in still said 1000 -- the divergence the migration's own comment tells the next reader cannot happen -- and `daemon-reload-NOPE` satisfied the reload check. Every assertion is verified against a mutation that defeats the old form and against the unmutated tree, on a worker running a real user manager. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Codex XHigh <noreply@openai.com>
|
Re-reviewed at
The One refinement worth having in the comment, because it changes what a future reader may rely on: the mechanism is filename ordering, not the "Gone once the user has fully logged out" holds for Omarchy: Two of the four assertions still passed a drop-in that does nothing — pushed Merge order has changed since the earlier comments, and not in the direction they assumed. They said the stable half needs "the Also worth knowing: omacom/omarchy-pkgs#191 is a draft that adds the same two What this costs the build, since it is a system-wide scheduling change. Nothing else outstanding for you. Waiting on the maintainer for the |
|
Closing this in favour of the BORE scheduler, at the maintainer's call. Omarchy has booted its own For the record, BORE works on individual tasks and leaves Thank you for the careful write-up and the measurements. |
Problem
When a few things compile at once — which happens by accident all the time now: a Qt/QML app, a Rust rewrite, a couple of agents in worktrees behind a terminal multiplexer — the mouse starts stuttering and keys arrive late or in bursts. It feels like a hardware problem. It isn't.
Hyprland, the shell, PipeWire, the portals and D-Bus run in
session.slice. Everything the user launches — browsers, terminals, and everycargo/ninja/cc1plus/rustcthose terminals spawn — runs inapp.slice. Both slices ship at systemd's defaultcpu.weight=100. Under saturation the compositor's input loop is just another runnable thread waiting for a CFS slot, and libinput says so:Anyone can check their own session for this signature (no root needed):
Binned, from a ~36 h Hyprland session on a Dell XPS 14 / Panther Lake driving a 5K display while doing normal dev work (Hyprland C++ build, cargo builds, 40 Chrome renderers):
Every 250 ms+ entry and every
SYN_DROPPEDlines up with a load spike of 15–30 on 16 cores from builds in terminals. Memory, swap and GPU were healthy at those moments — this is CPU arbitration, and it's happening in the one cgroup that must never lose it.Change
Ship
/usr/lib/systemd/user/session.slice.d/10-cpuweight.conf:That gives the interactive tier a 10:1 share over
app.slice(background.sliceis already 30, so the ordering becomes session ≫ app > background, which is what GNOME/KDE sessions effectively do). CPU weight is work-conserving: it only arbitrates under contention. An idle machine is unchanged, and builds still get every core the compositor is not using at that instant — which is almost all of them. The compositor just stops losing the argument. Memory and IO are untouched; this is orthogonal to the oomd tiering inapp.slice.d/10-oomd.confand follows the same packaging pattern.Why not the alternatives:
Nice=on Hyprland alone: per-thread, doesn't cover the shell/PipeWire/portals, andsched_autogroupflattens nice across sessions anyway.SCHED_FIFO/RRon the compositor: a compositor that ever spins becomes a hard input lock; Hyprland upstream deliberately elevates only specific threads.nice -n 19on builds: opt-in, forgotten, doesn't cover Chrome.Evidence (anecdotal, stated as such)
Applied live with
systemctl --user set-property session.slice CPUWeight=1000during a bad episode (load 31, CPU PSIsome60 %, Hyprland + cargo builds running). Subjectively: immediate. Mouse stopped stuttering, typing stopped hanging, while the builds kept going. "Huh, this really fixed things."A short synthetic A/B (48 burners in
app.slice, real uinput mouse at 400 Hz, 60 s each) measured Hyprland's cgroup CPU stall (cpu.pressure some) at +314 ms with weight 1000 vs +1150 ms at the default 100, and +540 ms vs +764 ms with a malloc/memset churn load. Synthetic load did not reproduce the 300 ms+ libinput stalls that real compiles cause in either configuration, so I'm not claiming this eliminates them — only that the compositor waits for CPU several times less, and that in daily use the difference is obvious.Included
default/systemd/user/session.slice.d/10-cpuweight.conf(commented)systemctl --user daemon-reloadso existing sessions pick it up live (same shape as the oomd migration; a TTY/SSHomarchy updategets it at next login)test/shell.d/systemd-test.sh: asserts the drop-in, that nothing else underdefault/systemd/usercarries aCPUWeight=(app scopes must stay default so the compositor out-ranks them), and that the migration reloadsdocs/file-layout.mdentryCompanion (after this lands): one
install -Dm644 default/systemd/user/session.slice.d/10-cpuweight.conf "$pkgdir/usr/lib/systemd/user/session.slice.d/10-cpuweight.conf"inomarchy-settings' PKGBUILD in omarchy-pkgs, next to the oomd line. Happy to open that too.Verified live:
cat /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/session.slice/cpu.weight→1000,hyprctl configerrorsclean, Hyprland/Quickshell/PipeWire all still insession.slice, apps inapp-*.scope.