Repository navigation
Conversation
oxyos-accountd, the root service that already follows the machine's sessions, follows logind on a thread of its own (src/seat.rs): seat0's ActiveSession, UserNew and UserRemoved. At each, and at its start, it reads each user slice's weights from systemd and sets them with SetUnitProperties (runtime): the user of seat0's active session (the person, or the login screen while it shows) raised to CPUWeight=400 and IOWeight=400, a slice weighing 400 off the seat set back to its default (unset), nobody else written. Fast user switching moves the raise at once; a lock changes nothing; a slice left raised (the service down when the seat changed, or a slice made again with an old runtime drop-in) is lowered at start and when its user appears. It waits on the bus alone. `oxyos-accountd --apply-seat-weights USER_SLICES SEAT` gives a cgroup tree that is not systemd's the same weights, without root: the saturation benchmark's S7 weighs its two users so, measuring this policy rather than a copy of it. A root process under oxyos-accountd.service's own sandbox (no CAP_SYS_ADMIN, ProtectControlGroups) may call SetUnitProperties on the system bus: checked on seldon on a throwaway slice (cpu.weight 400, io.weight default 400, then unset). The unit changes only in its header. Measured with perf.py saturation, S7 (another user's CPU load on every CPU of the run), main against this, interleaved, p95 of each of two runs: on the ThinkPad typing 34.5, 16.5 -> 18.0, 18.5 ms (S0 7.6), the pointer 23.0, 9.9 -> 9.4, 6.9 (S0 6.0), the drag unchanged (6.0, 8.9 -> 8.2, 9.2; S0 5.0). Tests: the policy, the benchmark's tree, and logind and systemd played on a private bus driving the thread. ADR 0066 decision 8 and step 7; ADR 0020 decision 3 amended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… service in background.slice ADR 0066, decision 3. Every application, the compositor's shell and its search service ran in the logind session's scope at one weight, so an application's thirty busy threads got thirty times the compositor's share of a processor. Now each process the launcher starts (a Bloom host or a program, the file chooser too) starts as oxyos-scope, which asks the person's user manager for app-oxyos-<id>-<pid>.scope in app.slice with its own pid (StartTransientUnit: Slice, PIDs, CPUWeight=100 so app.slice gets the CPU controller and each application is a group of its own, CollectMode=inactive-or-failed), waits for its job, then executes the application's program in the same process: the launcher's child, its pid and the pidfd it registers stay the application's, nothing the program does happens outside its scope, and the compositor's turn never waits on the bus. The compositor and the shell stay in the session's scope, a sibling of the user manager: together they weigh as much as every application together. The search service is placed in background.slice (ADR 0051 decision 13 amended: its premise, no user manager, is false on the device). A scope that cannot be had (no user bus, a refusal, no answer in 5 s) is said once and the program runs where it was started; the login screen launches nothing. crates/oxyos-scopes: the scopes' names (systemd-escaped ids), the user manager's side (placing, and SetUnitProperties for this boot), the saturation benchmark's fixture (OXYOS_CGROUP_FIXTURE: the same layout made with the control group filesystem's files, each level enabling its parent's controllers), and Scopes, the handle decisions 4 and 5 weigh running applications with (off the caller's thread, the latest asked winning, waited for while a scope is being placed); a played systemd manager for tests. oxyos_apps::Scoping wraps a launch (the program found as execvp would, a missing one failing the launch as before). The development compositor places what it starts only under OXYOS_CGROUP_FIXTURE (the benchmark), so the gate runs as before; a scenario's `scopes` runs it with a tree of its own and checks what each slice holds (application-scopes, app-crash). The deploy installs /usr/libexec/oxyos/oxyos-scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ce; scenario holds its turns
…p.slice given their sum
…nges, for the accounts' service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #532 (step 7) and #545 (step 4): until they land this diff carries them. The follow-up's own changes are in
crates/oxyos-account/src/session.rs,tools/oxyos-accountd/src/{main.rs,seat.rs,seat/tests.rs}and the session's listener intools/oxyos-session/src/main.rs. Its floors test needs step 6's drop-ins (#553). Draft until those land; then main merged in, ADR 0066 decisions 7 and 8 updated.ADR 0066, decisions 7 and 8: the seat's applications' memory protection follows their claims.
Step 4 (#545) protects the focused application's working set with
MemoryLowon its scope and gives the user manager'sapp.slicethe sum of the claims. With cgroup2'smemory_recursiveprot(the ThinkPad's mount) a protection reaches a group only as far as each ancestor's covers it, and those ancestors (user@UID.service,user-UID.slice,user.slice) are system units only root sets; step 6's static floors are sized for the session's services alone, so the focused app got about 90 MiB of a 300 MiB working set. A static raise would leak: protection a parent's children do not claim is shared out by usage, i.e. to the hog.oxyos-accountd({"memoryClaim": {"bytes": N}},RegistrarThread::memory_claim): fire-and-forget, the latest re-told on every reconnection. Wired to Weights by state and App Nap (ADR 0066, step 4) #545'sNaps::with_claim_listener(rate-limited there: on a focus change or every 10 s, only when the 16 MiB-rounded sum changes). Applications may not claim (only the registrar). Not the display protocol: no version.oxyos-accountdcarries it up for the seat's holder alone (the thread of The person at the seat outranks other users (ADR 0066, step 7) #532):user@UID.serviceanduser-UID.sliceMemoryLow= floor + claim,user.slice= its floor + claim, capped at 50 % of the machine's memory (seat::lows); another user's claim is kept and given while that user holds the seat; a claim ends with its session's connection; leaving the seat or ending sets the floors back, only where they were raised (seat::settle: a unit nobody raised keeps what it has). The floors (128M / 128M / 256M) are constants pinned by a test to step 6's drop-ins.oxyos-accountd --apply-memory-claim USER_SLICES SEAT BYTES(no root), whichperf.py saturationruns each time the fixture'sapp.slice/memory.lowchanges.Measured (the benchmark, ThinkPad, perf-device rules, three alternating rounds a side, p95 input to present, median of rounds [each round]): A = step 6 + #516 + #546 (floors stay); B = A + #545 + this.
S0 identical within 0.3 ms on both sides; no OOM kill or failed run; the session's memory stall under 1.4 % on both. The claims carried up every round: 0, 32, 48, 64 MiB (64 MiB →
user@.serviceand the user's slice 192 MiB,user.slice320 MiB; 0 → the floors). B is #545's claim and this carry-up together: the claim without its ancestors raised is capped at the static floors.Tests:
oxyos-account(the claim handed over and ended with its connection, the registrar thread telling it without waiting, a registered application refused, the wire format);oxyos-accountd(the policy: carried over each floor and capped; raised and lowered only where raised; a user's claim its sessions' largest; the floors equal step 6's drop-ins; the benchmark's tree; and logind + systemd played on a private bus: a claim carried up, another user's kept but not given, fast user switching handing it over, a session's end restoring the floors, the cap).🤖 Generated with Claude Code