test(libc): skip the failed heap commit check when the host overcommits #6310
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6310"
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?
Imported from boykopovar/AnyPS5. Originally posted by eliyarson on 2026-10-15T10:51:35Z.
What
guest_allocator_failureslimitsRLIMIT_DATAto 128 MiB and expectsmalloc(300 GiB)to fail withENOMEM. A guest heap commit ismmap(MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, RW)over an existingPROT_NONE/MAP_NORESERVEarena reservation. Observed on Linux 7.2, a 300 GiBMAP_FIXEDRW mapping over such a reservation succeeds underRLIMIT_DATA=128 MiB(the replaced pages are subtracted, so the limit is not charged), while a fresh 300 GiB RWmmapfails withENOMEM. Only the overcommit heuristic (vm.overcommit_memory=0) or strict mode (2) can make the commit fail. On hosts that setvm.overcommit_memory=1(kubelet/k3s sets it) the commit succeeds and the test reportedmalloc(300 GiB): succeeded despite RLIMIT_DATA.Test only. When the 300 GiB commit succeeds, Linux now takes the skip path the other platforms already had, and the skip line prints the
vm.overcommit_memoryvalue. The remaining allocator checks still run and the test exits 0 when nothing failed, asGuestAmpr.cppdoes for its partial skips. TheRLIMIT_DATAsetup is unchanged.Tested
CachyOS, Linux 7.2.2-1-cachyos,
vm.overcommit_memory=1:ctest -R guest_allocator_failurespasses and printsskipped: the host can commit 300 GiB (vm.overcommit_memory=1), so the failed commit and arena release checks did not run.python3 tools/check_conventions.py --base origin/mainpasses. Not tested: the failing-commit path withvm.overcommit_memory=0or2; Windows; macOS.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:18:26Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/tests/GuestAllocatorFailures.cppImported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T10:42:09Z.
Review: COMMENTED
Tested the path the description lists as untested: Linux with
vm.overcommit_memory=0. Ubuntu 26.04, kernel 7.0, GCC 15.2, Release full build, i7-8700, 30 GB RAM. Headd70e9fb6cmerged ontomain72c5eed1f.guest_allocator_failurespasses without skipping. Run directly, it printsChecked 10 failed heap commits and arena range reuseand exits 0, the same as on main, so the 300 GiB commit still fails under heuristic overcommit and the new skip is not taken.file_writer_*failures on both).I did not test
vm.overcommit_memory=1or2.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T03:30:41Z.
Thanks, the analysis matches what we see. One request before merge: please only take the skip when
overcommitMode() == 1. Under modes 0 and 2 a successful 300 GiB commit is still the failure this test exists to catch (jotitadev's mode 0 run shows the commit fails there), so it should keep callingreport("malloc(300 GiB)", ...), ideally with the mode in the message. The skip line for mode 1 is fine as written.Imported from boykopovar/AnyPS5. Originally posted by eliyarson on 2026-10-17T18:32:54Z.
Pushed as
90fbcba2c. The skip is now taken only whenovercommitMode() == 1. If the 300 GiB commit succeeds under any other mode — 0, 2, or -1 when the file cannot be read — the test callsreport("malloc(300 GiB)", "committed 300 GiB with vm.overcommit_memory=<mode>")and fails. The mode-1 skip line is unchanged.Tested: Release build,
cmake --build build --target guest_allocator_failures_testsexit 0, andctest -R guest_allocator_failurespasses. This host has/proc/sys/vm/overcommit_memory= 1, so the run takes the skip path and prints:python3 tools/check_conventions.py --base origin/main: all checks passed.Not tested: modes 0 and 2. Changing
vm.overcommit_memoryneeds root, which I do not have on this machine, so the new failure path has not run inside the test. I only compiled the branch snippet on its own with the mode forced to 0, 2 and -1 to check the message, which printedmalloc(300 GiB): committed 300 GiB with vm.overcommit_memory=0(and2,-1). jotitadev's mode 0 run (Checked 10 failed heap commits and arena range reuse) shows the 300 GiB commit fails under mode 0, so that path is unchanged by this commit. I have no mode 2 run. The non-Linux#elsepath is untouched and still skips when the commit succeeds, since there is no overcommit mode to read there.LLM assistance used.