flybrain/infra/units/flysim.slice
acamilo ab537d1045 infra: the sim's cpus are exclusive to the sim (PERF-02 review N1)
A pinned sweep worker cannot leave its cpu, so any sustained cpu-bound process allowed there
collapsed the session runtime to 0.14x real time. flysim and flysim-session now run in
flysim.slice (AllowedCPUs = the sim's set) and bin/fly-cpu-confine, run by their ExecStartPre,
confines system.slice, user.slice and init.scope to the other cpus. It refuses while a sim unit
still sits outside the slice (shrinking system.slice under it would make it float). Without a
partition the deploy writes FLY_SESSION_PIN=0. fly-recap and fly-retention run at SCHED_IDLE.
The drop-in plan is one function (cpuset_dropin_plan) shared by the deploy and lint; lint covers the
plan, the units, the deploy wiring and fly-cpu-confine against a stub systemctl and a fake /proc.
Runbook and README updated.
2026-10-01 15:01:47 +00:00

11 lines
641 B
SYSTEMD

# infra/units/flysim.slice — the sim's own slice (PERF-02 review N1).
# Named without a dash on purpose: systemd nests a slice named a-b.slice under a.slice, and a child's
# cpuset is bounded by its parent's; flysim.slice sits directly under the root slice, beside system.slice.
# flysim.service and flysim-session.service run here. 05-deploy.sh writes the drop-in
# flysim.slice.d/cpuset.conf (AllowedCPUs= the sim's CPUs) when the container has a cpuset
# partition; bin/fly-cpu-confine keeps every other slice off those CPUs. Nothing else belongs in
# this slice.
[Unit]
Description=The live sim (its CPUs are exclusive to it)
[Slice]