mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4258] [Engine] --drop-file-cache: hand the model files' page cache back once the startup reads are done #4976
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#4976
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/4258
Author: @G0-0000
Created: 10/26/2026
Status: 🔄 Open
Base:
main← Head:feat/drop-file-cache-20261027📝 Commits (1)
e09a687generate: --drop-file-cache hands the model files' page cache back after the startup reads📊 Changes
4 files changed (+131 additions, -1 deletions)
View changed files
📝
docs/DETAILS.md(+7 -0)📝
include/strata/core/expert_source.hpp(+8 -0)📝
src/core/expert_source.cpp(+64 -0)📝
src/program/generate.cpp(+52 -1)📄 Description
Problem
A resident engine maps the model files and reads them once at startup. By the time those reads are done every expert is in VRAM or in the RAM copy, but the kernel still holds the mapped model files' page cache: a third copy of the same bytes (about 55 GiB on a 48-layer pack), and the one copy the kernel cannot take back cheaply while this process maps the files. On a host whose RAM is mostly the model, that copy is what makes it page under load.
Change
--drop-file-cache(off by default, Linux only). Four files:FileExpertSource::drop_file_cache(std::string&)-madvise(MADV_DONTNEED)over each mapped view, thenposix_fadvise(POSIX_FADV_DONTNEED)on that file. One call alone releases nothing: a mapped page is skipped by fadvise, an unmapped clean page stays on the LRU. Measured here: the pair took all 512 MiB of a probe file (mincore back to 0); either call alone took none.generate.cpp- the option, its help text, and one call after the startup reads finish and before serving, with a log line that says how many bytes were advised.docs/DETAILS.md- one paragraph next to the file-tier section.Off is byte-identical to before: no code path changes unless the flag is given.
Relation to earlier work
Validation
Build: CUDA 12.9,
CMAKE_CUDA_ARCHITECTURES=70, engine target.Host tests:
ctest --test-dir build-dropcache -R "expert_source|cache|file"on this host: 9 tests, all 9 passed (file_expert_source_test, expert_profile_save_test, expert_profile_version_test, expert_cache_per_layer_test, expert_cache_segmented_test, expert_cache_slot_guard_test, uma_cache_test, conv_cache_test, direct_file_async_test).Hardware run, this same build, on a V100-32GB host (Linux), 2026-10-27: started with the expert complement resident and the flag on. The engine printed
and
/proc/meminfoCached fell from 77.2 GiB to 11.2 GiB at that point; the difference between advised and reclaimed is shared and dirty pages, as the message says. No request was served in that run. The host was returned to its production configuration afterwards and answered 200.Caveat: that run was not under the host's usual systemd NUMA binding, so the complement was not page-locked on the GPU's node. The drop itself is node-agnostic, but the RAM placement differed from a normal production start.
Limits
STRATA_FILE_RELEASE) and has no equivalent here.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.