mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5504] [Engine] Credit clean active_file cache in the conversation memory guard #5483
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#5483
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/5504
Author: @giphoo
Created: 11/7/2026
Status: 🔄 Open
Base:
main← Head:fix/active-file-cache-credit📝 Commits (1)
37bedf6Credit clean active_file cache in the conversation memory guard📊 Changes
1 file changed (+15 additions, -6 deletions)
View changed files
📝
src/core/conversation_memory.cpp(+15 -6)📄 Description
Problem and result
The conversation memory guard refused session reads on an mmap-heavy engine because
reclaimable_cache()only creditedinactive_file, giving 0 reclaimable bytes even when 17+ GiB of clean file cache sat on the active LRU list.After this change, both
inactive_fileandactive_fileare credited (less dirty and writeback, capped at the cgroup's current usage).Related discussion
none
Approach
The current comment says
active_file (it holds mlocked pages)- but on cgroup v2, mlocked pages are counted inunevictable, notactive_file. Cleanactive_filepages are regular file cache on the active LRU list and are reclaimable by the kernel.An mmap-heavy engine (model weights read through mappings) naturally keeps its file cache on the active list. Measured on a production system:
The guard read 0 credit and refused a 50 MiB session file read with 28 GiB actually free.
This PR credits
inactive_file + active_file, still less dirty and writeback, still capped at the cgroup's charged usage, and still does not credit shmem (the KV pool's pinned complements).Validation
Passed (reference implementation, Linux, cgroup v2, mmap-heavy workload):
Failed: none observed
Not run:
total_active_filepath is added but untested)Limits
active_fileassumes the kernel can reclaim those pages under pressure. On a system with genuine memory shortage, reclaiming active file cache causes I/O to re-read the pages later, trading latency for admission.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.