Repository navigation
[HiCache] Fall back to host memory when no cgroup fs is mounted - #42120
Merged
merrymercy merged 1 commit intoOct 2, 2026
Merged
Conversation
HiCache sizes its host pool from available_host_memory_bytes(), which bounds psutil's available memory by the process's cgroup headroom. When the process belongs to a cgroup but no cgroup or cgroup2 filesystem is mounted (for example a container that shares the host cgroup namespace without mounting cgroupfs), discovery raised "Cannot locate the process memory cgroup in mounted cgroup filesystems" and the engine failed to start. - If no cgroup filesystem is mounted at all, no limit is visible: log a one-time warning and size against host available memory. - A mounted cgroup filesystem that does not contain the process still raises, since it may hide a real limit; the error now names the override below. - New SGLANG_HICACHE_HOST_MEMORY_BYTES sets the host memory budget directly and skips cgroup and psutil discovery. The existing reserve and per-local-rank split still apply. Values <= 0 are rejected. Tests exercise available_host_memory_bytes() over a synthetic procfs: no cgroupfs (v1 and v2), the explicit budget where discovery would raise, and a mounted but unmatched cgroup.
raghotham
requested review from
Ying1123,
alphabetc1,
hanming-lu,
hnyls2002,
huangtingwei9988,
hzh0425,
ispobock,
merrymercy,
xiezhq-hermann and
yizhang2077
as code owners
October 1, 2026 19:57
Collaborator
|
This port clears our bar on gate 20✓✗6 lint✓ build✓ A✓ B✓ C 0/10⏳ other✓ · accel ✗amd,mlx,musa @merrymercy @raghotham — could one of you take a look and merge it if you are happy? Nothing else is waiting on our side. |
3 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 sizes its host pool from
available_host_memory_bytes(), which bounds psutil's available memory by the process's cgroup headroom. If the process belongs to a cgroup but nocgroup/cgroup2filesystem is mounted (for example, a container that shares the host cgroup namespace without mounting cgroupfs), discovery raisesand the server fails to start whenever a HiCache host pool is created. There was also no way to give the budget directly.
Modifications
mem_cache/host_memory.pySGLANG_HICACHE_HOST_MEMORY_BYTES: when set,available_host_memory_bytes()returns it and skips both cgroup and psutil discovery. The existing reserve and per-local-rank split inpool_host/base.pystill apply. Values <= 0 raiseValueError.environ.py: registersSGLANG_HICACHE_HOST_MEMORY_BYTES(EnvInt, default unset).Behavior is unchanged when cgroup discovery succeeds, and when no cgroup membership is present.
Tests
test/registered/unit/mem_cache/test_host_memory.pydrivesavailable_host_memory_bytes()through the real discovery code over a synthetic procfs:These replace the old test that expected an empty mountinfo to raise. All three fail without the change.
Ran locally:
pytest test/registered/unit/mem_cache/test_host_memory.py: 9 passed (13 subtests).GPU and e2e tests were not run locally.
CI States
Latest PR Test (Base): ✅ Run #36918037160
Latest PR Test (Extra): ❌ Run #36920089666
Latest PR Test (AMD ROCm 10): ❌ Run #36918036853