Skip to content

Seg/gaming performance - #9

Merged
SegMind25 merged 12 commits into
claude/vigilant-mendel-d96n55from
seg/gaming-performance
Oct 20, 2026
Merged

SegMind25 merged 12 commits into
claude/vigilant-mendel-d96n55from
seg/gaming-performance

Conversation

@SegMind25

Copy link
Copy Markdown
Owner

No description provided.

claude added 12 commits October 20, 2026 20:10
Two conflicts with what SegLinux Setup already writes for zram, found
while reading the code again:

- Setup writes /etc/sysctl.d/90-seglinux-zram.conf with vm.swappiness = 180.
  seg tune raised swappiness to only 100 with zram on and its 99-seg.conf
  sorts after Setup's file, so installed systems would have ended up at
  100. zram swap now means at least 180 in every profile.
- Setup also writes /etc/udev/rules.d/99-seglinux-zram.rules, which sizes
  and formats zram0 (fstab switches it on). seg zram on reset a sized
  device, which could run under that rule's mkswap. A sized device is now
  kept as it is, and the package's udev rule calls seg zram on
  --if-unconfigured, which leaves it alone entirely, as the old script did.
  An explicit --size still resizes.

Also puts back the comment in disk.rs that named Setup's udev rule: it was
right, and the earlier "fix" of it was wrong.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119819Vrp5vJojQCT1CjWog
Found by booting the Lite image in QEMU: killprocs, mount-ro and savecache
are enabled in OpenRC's `shutdown` runlevel and are, by design, not running
while the system is up, yet seg doctor called them "enabled but stopped".
Service gets runs_at_boot (enabled in sysinit, boot or default on OpenRC;
the same as enabled on the other inits) and doctor looks at that.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119819Vrp5vJojQCT1CjWog
…mits

The ISO check built both editions on this branch and booted Lite in QEMU
(run 39488187492); its results are in docs/lean-audit.md: the full ISO is
4.7 % smaller and 475 MiB less is installed, Lite is unchanged. The audit
claimed the kernel headers were on both editions; Lite never had them, so
the table says full only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119819Vrp5vJojQCT1CjWog
…g tune gaming

A lightweight GameMode inside the existing seg tool (libc is the only new
dependency; every unsafe block is in game/proc.rs).

- seg game run -- CMD (Steam: `seg game run -- %command%`): CPU governor and
  energy preference to performance and an AMD GPU to its high power level
  for the length of the game, through a root helper that several games
  share (state in /run/seg, dead games noticed by pid and start time);
  nice -4 and best I/O priority for the game; the screen saver held off
  over a hand-written D-Bus call (org.freedesktop.ScreenSaver.Inhibit);
  optional pinning to the V-Cache complex of an X3D CPU (found from the L3
  cache sizes in /sys); MangoHud and gamescope wrapping; shader cache sizes
  set. Everything is put back when the game ends, on SIGINT/SIGTERM/SIGHUP
  (INT is not forwarded: the terminal already did) and when seg itself
  panics (a hook, since panic=abort skips destructors).
- Per-game profiles in ~/.config/seg/games.toml, matched by the names in
  the command (a Proton command line matches its .exe); a small TOML
  subset parser that names the line of a mistake.
- seg game check: 15 PASS/WARN/FAIL checks (Vulkan, lib32 drivers, GPU
  driver, ntsync, max_map_count, open files, kernel and a fallback kernel,
  amd-pstate, governor, may boost, hugepages, split lock, compaction,
  mitigations), each failure with its exact fix.
- seg game setup: the driver packages for the GPUs found (sysfs + lspci);
  --yes installs them. Only for hardware that is there.
- seg game apply (for the seg-game service), audio on|off (low-latency
  PipeWire, per user), unsafe-boost on|off (mitigations=off, behind a
  warning and --i-understand, never done by anything else).
- seg tune gaming: low swappiness without zram (180 with it), warm caches,
  short writeback; the governor stays dynamic.
- Presets (all off until asked): MangoHud, low-latency PipeWire, the sudoers
  rule for the gamemode group, seg-game services for OpenRC, runit, dinit
  and s6.

183 unit tests use fake /sys and /proc trees in tests/fixtures (7950X3D,
second-CCD V-Cache, 7800X3D, ordinary CPUs, a VM; AMD, NVIDIA Ada and
Pascal, Intel Arc, a hybrid laptop). Release binary 566,576 -> 722,808 bytes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119819Vrp5vJojQCT1CjWog
segctl 0.1.0-2 installs the seg-game service for OpenRC, runit, dinit and
s6, /etc/sudoers.d/seg-game (the one root helper seg game run calls, for the
gamemode group only) and the MangoHud and low-latency PipeWire presets under
/usr/share/seg, all off until asked. The install script creates the group
(a chroot-safe getent/groupadd) and enables seg-game on the init that is
installed; an upgrade from 0.1.0-1 gets the new service, nothing else is
re-enabled.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119819Vrp5vJojQCT1CjWog
…odeset

- vm.compaction_proactiveness = 0: no background memory defragmentation
  while a game allocates (what SteamOS sets); on-demand compaction stays.
- nofile hard limit 524288 -> 1048576 (the kernel's fs.nr_open maximum) for
  Wine's esync/fsync; members of gamemode may use nice -10 for seg game run.
- MESA_SHADER_CACHE_MAX_SIZE 4G -> 10G and the NVIDIA cache set to 10 GiB
  without the cleanup that deletes it when full (profile.d, so every init;
  a value set by the user wins).
- nvidia_drm modeset=1 fbdev=1 (needed by Wayland compositors); does
  nothing unless the driver is installed.
- vm.swappiness is deliberately not in this file: 180 with zram is Setup's,
  10 without it is seg tune gaming's.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119819Vrp5vJojQCT1CjWog
wine-staging provides wine and adds the Staging patches (esync/fsync and
NTSYNC support, game fixes); lib32-mangohud covers 32-bit games.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119819Vrp5vJojQCT1CjWog
…g-game

- Install the other kernel (linux beside linux-zen and the reverse) as a
  boot menu entry to fall back on, when online; the kernel that runs is
  never removed. performance.fallback_kernel = false skips it.
- Kernel command line: transparent_hugepage=madvise on every kernel and
  amd_pstate=active on AuthenticAMD; a parameter of the same name in the
  answer file replaces the default.
- seg-game joins the default services, so the gaming sysctls and
  /dev/ntsync permissions apply on whichever init the install uses.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119819Vrp5vJojQCT1CjWog
…iles

- The dependency guard allows seg, lexopt and libc (3 lines of cargo tree).
- unsafe may only appear in src/game/proc.rs.
- visudo -cf checks the sudoers rule seg game run depends on.
- shellcheck covers the seg-game OpenRC script (the runit one is already
  matched by the glob).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119819Vrp5vJojQCT1CjWog
…od, changelog

- docs/gaming.md (the existing page; a second docs/GAMING.md would collide
  with it on case-insensitive checkouts): the seg game walkthrough, Steam and
  Lutris launch options, what the boost changes and how it is undone, a
  table of every seg game check line, safety notes, the updated tuning table
  and a stock-versus-seg-game benchmark method with MangoHud logs and a
  summary script (tested against an independent calculation on synthetic
  frame times; no benchmark numbers are given).
- tools/seg/README.md and docs/seg.md: the game commands, the gaming tune
  profile, the second dependency, the code layout and the privilege model.
- README.md and a new CHANGELOG.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119819Vrp5vJojQCT1CjWog
CI's pacman -Sp on a real Artix container reported it as the only missing
package of the full edition (wine-staging resolves). Removed from the
profile and from seg game setup --games, with a test so it is not added
back unchecked, and documented: 32-bit games get no MangoHud overlay unless
the user builds lib32-mangohud from the AUR, which the base does not use.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119819Vrp5vJojQCT1CjWog
CI only checked the packages in the ISO profiles, so nvidia-open-dkms,
nvidia-utils, lib32-nvidia-utils, nvidia-settings and vulkan-nouveau, which
seg game setup (and Setup) install on demand, were never looked up in the
repositories. A unit test now pins the union of everything seg game setup
can choose (tests/setup-packages.txt; SEG_WRITE_FIXTURES=1 rewrites it) and
check-packages.sh -x resolves that list on top of the image in every
package job.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119819Vrp5vJojQCT1CjWog
@vercel

vercel Bot commented Oct 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
seglinux Ready Ready Preview Oct 20, 2026 9:05pm UTC

@SegMind25
SegMind25 merged commit ac0d39a into claude/vigilant-mendel-d96n55 Oct 20, 2026
18 checks passed

This branch was successfully deployed

1 active deployment
Preview — 9105b630 Deployed Oct 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants