mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #3698] [Engine] Linux: start hangs/freezes the host at the prompt-path init when pinned memory lands on KHO scratch (CMA) - MemAvailable over-reports by ~17 GiB on Ubuntu 26.04 kernel 7.0 #1534
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#1534
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @q8atnight on GitHub (Oct 22, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3698
Summary
On Ubuntu 26.04 (kernel 7.0) about 17 GiB of RAM is reserved as kexec-handover (KHO) scratch and is handed to the page allocator as CMA.
MemAvailablecounts those pages as free, but pinned host memory (cudaHostRegister/cudaHostAlloc) cannot be placed there. With UD-Q5_K_XL, every expert in RAM and--kv fp16, the pinned total crosses the non-CMA capacity: the engine does not get an allocation error, the host stalls in direct reclaim and compaction, systemd-oomd kills the desktop, and two runs froze the PC hard. The engine's memory guard saw 116.3 GiB available and let the start through. This also corrects my report in #3278, which blamed "does not fit 121 GiB".Setup
--ulimit memlock=-1).v0.2.0-beta(engine 0.1.45.3), our tree = tag3d1fb480+ #1937 + #1525 + #3022 + #3280 + the decode half of #1099. All runs below used this tree.cudaHostRegister PORTABLE ok, buffered read),--layer-split 24 --trim-stage-weights --kv fp16 --kv-resident 20480 --max-context 262144 --prefill auto --spec 4 --mtp ... --vision(CPU)--pipeline-windows 2 --pcie-frac 0.2 --ple-gguf <Q8_0 shard 3> --ple-io direct --conversation-cache-mib 4096 --conversation-disk-dir ...Symptom
Reproduced 7 times (10-20 00:05; 10-22 08:08, 08:40, 09:13, 10:02, 10:20, 10:35). The start runs through the arena load and the GPU expert caches. The last lines (
STRATA_TRACE=1 STRATA_RSS_TRACE=1) are always:Then the whole host stalls: PSI memory some/full 81-97 %, systemd-oomd kills GNOME, dbus and user services, the SSH banner times out. Two of the runs hard-froze the PC (reset needed).
docker rm -ffirst answers "did not receive an exit event" and the container exits (137) about 30 s later.Snapshot during the hang (read as root, 10-22 10:08 and 10:50):
/proc/vmstat: allocstall_normal 171,567; compact_stall 3,377; pswpout 996,833 pages (~3.8 GiB); PSI io about 0, so it is not disk-bound./proc/meminfo: MemFree 18,591,564 kB, MemAvailable 18,048,232 kB, CmaFree 17,767,616 kB (CmaTotal reads 0 kB, a counter quirk). Of the ~18.6 GB "free", ~17.8 GB is CMA-type; non-CMA free is under 1 GB.The memory guard at the same start said:
limit 121.4 GiB (source: meminfo) ... available 116.3 GiB (MemAvailable 116.3 GiB), floor 2560 MiB.What was ruled out
--vram-reserve-mib 1200 --vram-reserve-later-mib 1000): same hang.STRATA_NO_ARENA_THP=1, same hang.--prefill 4096(loan 3.70 GiB per card), same hang.STRATA_PF_STEP_SYNC=1prints nothing (it covers prompts, not this init).K/V in 3.00 GiB of pinned RAMvs 1.55 GiB int8); MemAvailable once ready was 38.1 GiB (Q4, int8) and 36.6 GiB (Q4, fp16). Q5 + int8 live (10-22 10:57): MemAvailable 16.6 GiB, CmaFree 7.6 GiB.Root cause (as far as traced)
CONFIG_KEXEC_HANDOVER=y,CONFIG_KEXEC_HANDOVER_ENABLE_DEFAULT=y,CONFIG_MEMBLOCK_KHO_SCRATCH=y. The boot command line has nokho=and nocma=(onlycrashkernel=...,128G-:4096M). dmesg says "0K cma-reserved" and/sys/kernel/mm/cma/is empty, so it does not look like a normal CMA area./sys/kernel/debug/kho/out/scratch_lenandscratch_phys: 0.70 GiB @0x7a600000, 12.32 GiB @0x1b93400000, 4.21 GiB @0x1a86000000 = 17.23 GiB./proc/pagetypeinfo: 8,464 CMA pageblocks in Normal and 357 in DMA32 (2 MiB each, about 17.2 GiB)./proc/zoneinfoNormal:cma 4333568pages.nr_free_cmawas 4,147,664 on an idle box.kho_scratch=sets the sizes (admin-guide/mm/kho).MemAvailablereports is unusable for the arena, KV and pinned buffers. With Q5 + fp16 the pinned total crosses the non-CMA capacity, which gives the reclaim/compaction storm instead of an error.I have not yet changed anything on the kernel side to confirm this; see Workaround.
Suggested engine-side fix
STRATA_PIN_GUARD, thememory guard: ... available ... (MemAvailable ...)line) should subtractCmaFreefrom/proc/meminfo(or count only non-CMA free pages from/proc/pagetypeinfo/zoneinfo) when it budgets pinned memory, and refuse the start with a clear message instead of letting the host freeze.docs/TROUBLESHOOTING.md: kernels withCONFIG_KEXEC_HANDOVER_ENABLE_DEFAULT=y(Ubuntu 26.04, kernel 7.0) hide about 13-17 % of RAM from pinned memory here. Check withgrep CmaFree /proc/meminfo; workaroundkho=off.Workaround
Planned, not tested yet: boot with
kho=off, or with a smallkho_scratch=. Expected: about 17 GiB more usable for pinned memory, and Q5 + fp16 should start. I will report the result in this issue.@q8atnight commented on GitHub (Oct 22, 2026):
Follow-up: the
kho=offworkaround is confirmed on this box.kho=offtoGRUB_CMDLINE_LINUX_DEFAULT,update-grub, reboot (Ubuntu 26.04, kernel 7.0.0-31-generic).CmaFree: 0 kB(was ~16.6 GiB on an idle box),/proc/cmdlineshowskho=off.--kv fp16with every expert in RAM (91.61 GiB arena) now starts on the first try, same flags as in the report. Warm: MemAvailable ~12 GiB, no reclaim storm, no oomd kills.So for anyone on a
CONFIG_KEXEC_HANDOVER_ENABLE_DEFAULT=ykernel who pins most of their RAM: checkgrep CmaFree /proc/meminfo; if it is large,kho=offgives it back to pinned memory.A separate, smaller thing seen right after that first successful start (not KHO-related): with only ~50-190 MiB of VRAM left per card (
--vram-reserve-mib 400), the first long prompt crashed the engine withprefill gemm: cublasGemmEx f16: cuBLAS status 14; the server restarted it on the next request. With the values the engine's own start-up warning suggests (--vram-reserve-mib 727 --vram-reserve-later-mib 999) it runs clean (now 363 / 620 MiB free after warm-up). The start-up warning is therefore right to call it LOW; maybe the reserve could default to that figure on a layer split with fp16 KV.@Niko1221 commented on GitHub (Nov 5, 2026):
Thanks for taking the time to report this.
Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.