[Bugfix][KV Offload] Check cgroup memory before SHM allocation (#54014)

Signed-off-by: Alex <jihui.huang@daocloud.io>
Signed-off-by: AlexHuang <alex.tech.lab@outlook.com>
Signed-off-by: Alex <alex.tech.lab@outlook.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: Itay Etelis <92247226+Etelis@users.noreply.github.com>
This commit is contained in:
AlexHuang
2026-09-16 09:17:50 +03:00
committed by GitHub
co-authored by OpenAI Codex Itay Etelis
parent e0301afb2a
commit 0f8fa53acf
7 changed files with 343 additions and 34 deletions
@@ -135,7 +135,10 @@ class SharedOffloadRegion:
self._creator = True
if creator_memory_check is not None:
creator_memory_check(self.total_size_bytes)
check_shm_free_space(self.total_size_bytes)
check_shm_free_space(
self.total_size_bytes,
allocation_name="CPU KV offload shared region in /dev/shm",
)
os.ftruncate(self.fd, self.total_size_bytes)
logger.info(
"Created mmap file %s (%.2f GB)",