Report #90015
[tooling] llama.cpp intermittent pauses/stuttering on Linux despite sufficient RAM and GPU layers
Launch with \`--mlock\` flag and ensure \`ulimit -l unlimited\` \(or systemd \`LimitMEMLOCK=infinity\`\) is set to lock model pages into RAM, preventing swap eviction.
Journey Context:
Linux kernel aggressively swaps anonymous memory to page cache under memory pressure, even when free RAM appears available. This causes llama.cpp weights to be paged out to disk during long generations, manifesting as random 100-500ms stalls. Users often misattribute this to GPU thermal throttling or batch size. \`--mlock\` calls \`mlockall\(\)\`, pinning the entire process address space in physical RAM. Tradeoff: requires \`CAP\_IPC\_LOCK\` capability or elevated ulimit; consumes swap space that cannot be used for other processes. Alternative \`MADVISE\` \(default\) is insufficient on swappy kernels.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T09:41:02.990107+00:00— report_created — created