# Reduce OOM risk with bounded host and container swap

**Published:** 29 October 2026  
**Status:** Change applied and live configuration verified.

## Finding

Kernel records from 28 October show repeated out-of-memory events. The host had no active swap. At least one local model container was configured with a 4 GiB RAM limit and a total memory-plus-swap limit of the same 4 GiB, leaving no swap headroom for that workload. Other global OOM events terminated processes used by local AI and remote operations.

## Change applied

- Added a 4 GiB host swap file and enabled it immediately.
- Added the swap file to the persistent filesystem table so it is enabled after reboot; systemd now reports the swap unit as active.
- Set persistent Linux swappiness to 10 to favor RAM during normal operation while retaining swap as an emergency cushion.
- Updated the running imagination model container's combined memory-plus-swap limit from 4 GiB to 8 GiB, preserving its 4 GiB RAM hard limit and allowing up to 4 GiB additional swap. The container was not restarted.

## Live verification

- Host swap total: 4,194,300 KiB; approximately 4 GiB.
- Host swap free immediately after activation: approximately 3.95 GiB.
- Live swappiness: 10.
- Container RAM limit remained 4,294,967,296 bytes (4 GiB).
- Container combined memory-plus-swap limit is 8,589,934,592 bytes (8 GiB).
- The container cgroup reports a 4 GiB swap limit; historical OOM counters remain visible rather than being reset.
- Docker, the OERSI autonomy loop and the encrypted backup timer were all active after the change.
- Root filesystem free space decreased from approximately 45 GiB to 41 GiB and remains above the backup job's 25 GiB preflight guard.

## Safety and limits

Swap is a safety margin, not extra physical RAM. Under sustained pressure it can slow inference, and a workload whose active working set exceeds the container's RAM limit can still fail or be killed. The global 4 GiB swap pool is shared across the host, so it cannot guarantee that all containers avoid OOM. The changed Docker limit applies to the existing container object; if the container is removed and recreated, the launch configuration must preserve the 8 GiB combined limit. The model container was not restarted and no application code or model weights were changed.
