mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2217] [CLOSED] Fix the cgroup RAM grant ignoring clean active file cache #3929
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#3929
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2217
Author: @kuhlsnu
Created: 10/13/2026
Status: ❌ Closed
Base:
main← Head:upstream/active-file-reclaimable📝 Commits (1)
6f2dd40Count clean active file cache as reclaimable under a cgroup limit📊 Changes
3 files changed (+50 additions, -11 deletions)
View changed files
📝
include/strata/core/expert_source.hpp(+2 -1)📝
src/core/expert_source.cpp(+21 -4)📝
tests/core/file_expert_source_test.cpp(+27 -6)📄 Description
Title
Issue: none filed, the numbers are below.
Summary
Bug: in a container, the resident RAM budget swings with the page cache's history instead of the box. It changes how much RAM a start is granted, not decode or prefill speed.
cgroup_available_bytescredits onlyinactive_file, but the model files Strata reads while loading land on the active list, so the same box with the same 50 GiB container cap granted 0.00, 20.29, 17.53, 29.66 and 26.99 GiB across five starts (2x RTX 3090, 2026-10-09). The container held 21.59 GiB ofactive_fileand 0.75 GiB ofinactive_fileat the time.This counts clean active file pages as reclaimable too, still bounded to
memory.currentand less dirty and writeback pages, so the grant stops depending on which cgroup paid for the cache first.What changed
src/core/expert_source.cpp:cgroup_available_bytessumsinactive_file + active_file(saturating), andread_cgroup_memory_statreads and requiresactive_filelike the other counters.include/strata/core/expert_source.hpp:CgroupMemoryStatgainsactive_file.tests/core/file_expert_source_test.cpp: a loaded-model case (the 3090 numbers), a sum bounded tocurrent, and an overflow case.Left alone on purpose:
pin_blobsingenerate.cppregisters mapped file ranges, and those pinned pages sit on the active list without being reclaimable, so crediting them could overstate the room. I have no AMD box to measure it on.sycl/src/core/expert_source.cpp) andconversation_memory.cpp's own credit rule are unchanged.On the comment in
conversation_memory.cppthat active_file "holds mlocked pages": as far as I can tell the kernel moves mlocked pages to the unevictable list (Documentation/mm/unevictable-lru.rst), so that is not a reason to leave active_file out. Pinned (registered) file pages are, which is why HIP is excluded here.Extra Notes
What ran (WSL Ubuntu 24.04, g++ 13.3, CUDA 12.0 for the
.cuobjects the test links):file_expert_source_testpasses on this commit. Against the parent it fails to compile (the struct gained a field), and with the old inactive-only sum it fails withclean active file cache was not credited against the cgroup cap.ctest: 39/39 before and after.Not run yet: the after-fix grant on the GPU box. The patched build has served on that box since 2026-10-09 with no budget refusal in its 127 start and stop logs, but those starts did not log the grant. I'll add five instrumented cold starts as a comment after 2026-10-15.
Not built: HIP and SYCL. The HIP branch is a preprocessor switch back to the current rule; with
-DSTRATA_USE_HIP=1both changed files compile and the test passes on the CPU build, which checks the branch logic but not ROCm. SYCL's files are not touched.Default behaviour changes inside a cgroup with active file cache, so this is a fix to the default path rather than an opt-in feature; without a cgroup memory limit (
memory.maxofmax) nothing changes.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.