mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2243] [CLOSED] drop-file-cache: --drop-file-cache returns the model files' page cache after the startup reads (opt-in) #3946
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#3946
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/2243
Author: @G0-0000
Created: 10/13/2026
Status: ❌ Closed
Base:
main← Head:feat/drop-file-cache📝 Commits (1)
b392dddgenerate: --drop-file-cache gives the model files' page cache back after the startup reads📊 Changes
4 files changed (+194 additions, -1 deletions)
View changed files
📝
include/strata/core/expert_source.hpp(+8 -0)📝
src/core/expert_source.cpp(+52 -0)📝
src/program/generate.cpp(+54 -1)📝
tests/core/expert_layout_test.cpp(+80 -0)📄 Description
What it changes
New opt-in engine flag
--drop-file-cache(Linux): after the startup reads complete, and only when aself-check confirms that no expert is read from the files, the engine issues madvise(MADV_DONTNEED)
followed by posix_fadvise(POSIX_FADV_DONTNEED) over the model files' mapping, which returns the page
cache to the kernel (both calls are needed; either alone does not release the pages).
What it leaves alone
With the flag absent, no syscall is issued and nothing changes byte for byte. The self-check refuses
to run the drop whenever any expert is read from the files (mapped-only layouts, partial complements).
Why
The engine maps the model GGUFs MAP_SHARED and reads the experts through them once; the kernel keeps
those pages for the life of the process, so a 24/7 server holds a full extra copy of the expert data in
the page cache (measured 55.4 GiB on the host below) even though every expert is already in VRAM or in
the page-locked RAM copy - the reads that actually need the cache are only the lend-region refills
(~4 GiB). Related discussions: #1194, #1682, #1571 (the Windows working-set analogue).
How it was measured
Same host as the NUMA placement (Supermicro X10DRC, V100-SXM2-32GB, Qwen3.8-Flash-Next UD-IQ4_XS,
125 GB RAM):
region (~1.2-4 GiB) from the drive once (+5-8% on that request), and the pages return through the
file cache afterwards.
How it was tested
GPU-free: a synthetic two-shard unit test (mapped pages 3452 -> 0, the advised byte count, and a
byte-identical re-read after the drop) plus the full non-CUDA ctest subset; on-GPU: two controlled
stop-the-service windows (reclaim amount, refill placement, interleave A/B) and a production run.
Note
A local extension binds the refill reads to the cold NUMA node (so the pages that come back land away
from the GPU's node); it depends on the --numa-hot-node feature and can be sent as a follow-up if this
is of interest.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.