Skip to content

feat: zram, systemd-oomd, and user-slice memory caps - #20

Merged
bupd merged 1 commit into
mainfrom
feat/zram-oomd-memory-safety
Aug 12, 2026
Merged

feat: zram, systemd-oomd, and user-slice memory caps#20
bupd merged 1 commit into
mainfrom
feat/zram-oomd-memory-safety

Conversation

@bupd

@bupd bupd commented Aug 12, 2026

Copy link
Copy Markdown
Member

Builds (cargo/webpack/tsc/link steps) can balloon memory on this laptop's 8GiB and, with no swap and no OOM intervention, thrash the kernel until it hard-hangs and needs a force reboot. Same class of problem #15 already fixed for the bootc build itself, applied here to the running desktop:

  • zram-generator: compressed RAM swap (up to 8GiB, zstd) absorbs spikes instead of the kernel having nowhere to reclaim to.
  • systemd-oomd: enabled with SwapUsedLimit=90%, watches memory pressure (PSI) and kills the worst offending cgroup before the whole system grinds to a halt.
  • user-.slice caps: MemoryHigh=85% / MemoryMax=92% — caps everything the user session runs (builds, browser, terminal) at 85% of RAM, always reserving headroom for system.slice and the kernel.

Verified live via usr-overlay + matching /etc drop-ins before landing here: zram0 came up as 7.4G zstd swap, systemd-oomd.socket enabled and listening, and the slice cap applied and reads back correctly via systemctl show. Full bootc container lint pass via a real task build-pc still pending — will follow up separately.

Builds (cargo/webpack/tsc/link steps) can balloon memory on this
laptop's 8GiB and, with no swap and no OOM intervention, thrash the
kernel until it hard-hangs and needs a force reboot. Same class of
problem #15 already fixed for the bootc build itself, applied here to
the running desktop:

- zram-generator: compressed RAM swap (up to 8GiB, zstd) absorbs
  spikes instead of the kernel having nowhere to reclaim to.
- systemd-oomd: enabled with SwapUsedLimit=90%, watches memory
  pressure (PSI) and kills the worst offending cgroup before the
  whole system grinds to a halt.
- user-.slice MemoryHigh=85% / MemoryMax=92%: caps everything the
  user session runs (builds, browser, terminal) at 85% of RAM,
  always reserving headroom for system.slice and the kernel.

Verified live via usr-overlay + matching /etc drop-ins before landing
here: zram0 came up as 7.4G zstd swap, systemd-oomd.socket enabled and
listening, and the slice cap applied and reads back correctly via
systemctl show.

Signed-off-by: Prasanth Baskar <prasanth@8gears.com>
@bupd
bupd force-pushed the feat/zram-oomd-memory-safety branch from d9e9cf1 to 677729c Compare August 12, 2026 08:20
@bupd
bupd merged commit dc4bae3 into main Aug 12, 2026
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.

1 participant