Repository navigation
[HiCache] Account for reclaimable page cache in cgroup headroom - #41181
Closed
paulzhang-tm wants to merge 2 commits into
Closed
paulzhang-tm wants to merge 2 commits into
paulzhang-tm wants to merge 2 commits into
Conversation
Exclude clean file LRU pages from charged usage when estimating host memory available under cgroup limits. Keep dirty, writeback, and shared memory charged, and preserve ancestor and host-availability bounds. Extend the existing host-memory tests for both cgroup versions, ancestor page cache, memory.high, and inconsistent counter snapshots. Co-authored-by: James Sun <jamessyt@gmail.com>
paulzhang-tm
requested review from
Ying1123,
alphabetc1,
hanming-lu,
hnyls2002,
huangtingwei9988,
hzh0425,
ispobock,
merrymercy,
xiezhq-hermann and
yizhang2077
as code owners
September 24, 2026 22:22
Collaborator
|
/rerun-test -c |
Contributor
|
Results for 🚀 |
This was referenced Sep 30, 2026
Venkat2811
added a commit
to datacrunch-research/sglang
that referenced
this pull request
Oct 3, 2026
…stream sgl-project#42039) Squash of the kimi-k3 integration PR #12 (layer 5a): upstream sgl-project#42039 applied verbatim (host_memory.py and its unit test), nothing else. Since sgl-project#40135 the host-pool budget is limit - memory.current, and memory.current includes the page cache charged to the cgroup, including the checkpoint the server just read. This counts that cache as reclaimable headroom so an explicitly sized HiCache pool is not refused at startup. Retire when sgl-project#42039 merges. If sgl-project#41181 lands instead (same lines, different text), drop this layer on the rebase. Upstream: sgl-project#42039 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Collaborator
|
please resolve the conflicts @paulzhang-tm |
Collaborator
|
fixed by #42420 |
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
HiCache can reject startup or unnecessarily shrink its automatically sized host pool when clean file cache remains charged to a container or an ancestor cgroup. The cgroup-aware check introduced in #40135 uses
limit - usage, but Linux can reclaim clean cached file pages to satisfy new allocations. Those pages can remain charged after the job that read them exits.For example, a 900 GiB cgroup with 850 GiB charged usage, including 600 GiB of clean file cache, previously reported only 50 GiB of headroom. This change estimates 650 GiB, still capped by host available memory and all applicable ancestor limits.
Modifications
memory.statat each constrained cgroup and subtract clean file-LRU pages from charged usage:max(0, inactive_file + active_file - dirty - writeback). Use the hierarchicaltotal_*counters for cgroup v1.memory.statis absent, and clamp inconsistent counter snapshots. Use one adjusted usage reading for bothmemory.maxandmemory.highat each level.memory.high, and counter clamping.This changes the headroom estimate; allocation behavior, safety reserves, and sizing options remain unchanged.
Accuracy Tests
All 14 host-memory unit tests passed:
All applicable pre-commit checks passed for the two changed files:
No model-output changes; no GPU/server launch was run.
Speed Tests and Profiling
Not run: the change is limited to host-memory sizing during initialization.
Checklist
CI States
Latest PR Test (Base): ✅ Run #36398928434
Latest PR Test (Extra): ✅ Run #36398927898
Latest PR Test (AMD ROCm 10): ❌ Run #36398928378