mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3893] [Engine] read the available RAM on sysvinit + elogind hosts (a cgroup without the memory controller has no limit) #4818
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#4818
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/3893
Author: @crhy
Created: 10/23/2026
Status: 🔄 Open
Base:
main← Head:fix-elogind-cgroup📝 Commits (1)
b1a1bbbengine: a cgroup v2 group without the memory controller has no limit at that level (elogind sessions on sysvinit hosts read "RAM unknown")📊 Changes
2 files changed (+30 additions, -3 deletions)
View changed files
📝
src/core/expert_source.cpp(+15 -3)📝
tests/core/file_expert_source_test.cpp(+15 -0)📄 Description
Problem and result
On a Linux host that runs sysvinit with elogind instead of systemd (Devuan, and Spaced Linux, which is built on it), the engine cannot read the available RAM:
detail::host_available_memory()returns false.elogind puts the login session in its own cgroup v2 group (
0::/1here), but the root'scgroup.subtree_controlis empty, so the memory controller is never enabled below the root. The session group therefore has nomemory.maxand an emptycgroup.controllers. The probe treats every non-root group without a readablememory.maxas an unreadable limit and gives up.After this change, a group whose
cgroup.controllersis readable and does not listmemoryadds no limit at that level. Its ancestors are still checked, so a limit set higher up still applies. A group that does list the memory controller but has no readablememory.maxstill fails, as before.Related discussion
none (a focused fix; I found no existing issue or PR about elogind or sysvinit cgroups)
Approach
The only change is in the cgroup v2 walk of
host_available_memory(): the existing root-group exception is extended to non-root groups whosecgroup.controllersshows the memory controller is off. That file is the kernel's own statement of which controllers the group has, so the check does not guess from missing files. Nothing changes for systemd hosts, containers or cgroup v1: those groups either listmemoryor are not affected by this branch.The host's layout, for reference:
Validation
Environment: Spaced Linux (Devuan based, sysvinit + elogind), kernel 7.2.11, RTX 4070 Ti SUPER (sm_89), CUDA build.
Passed:
host_available_memory()on this host, compiled verbatim fromexpert_source.cppinto a small standalone probe: atorigin/main(7ddc17a3) it returnsfalse; with this change it returnstrue, available 19.4 GiB, no cgroup limit (/proc/meminfoMemAvailable at the time: 19.5 GiB).test_host_memory()with the three new cases (a group with the memory controller but nomemory.maxstill fails; a group without the controller reads MemAvailable alone; the same group under a 48 GiB parent limit gets the parent's limit). They fail atorigin/main(v2 group without the memory controller: MemAvailable alone) and pass with the change.file_expert_source_teston this branch (-DSTRATA_ENABLE_CUDA=ON -DSTRATA_BUILD_TESTS=ON -DCMAKE_CUDA_ARCHITECTURES=89, CUDA 13.4, GCC 16.2): builds with no warnings fromexpert_source.cpp;build-cuda/file_expert_source_testends withfile_expert_source_test: PASS.Failed:
none observed
Not run:
main: an earlier form of this fix has run as a local patch since 2026-10-17 on engine 0.1.38 built from source, serving the Coder IQ1_M model daily; the currentmainwith this change has not served a model here.Limits
Only cgroup v2 is affected. A host that limits memory some other way (for example
ulimit -v) is still not seen, as before.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.