Repository navigation
Conversation
… for systemd-oomd (#752)
…up charged over the limit (#752)
…address spaces, and a swap read is a memory stall (#752)
… until their turn (#752)
…lt (#752) Linux delivers the fatal signal before mem_cgroup_handle_over_high at the return to user mode, and out_of_memory gives true for a task in task_will_free_mem. Before, the killed workers of stress-ng in TEST-55-OOMD wrote pages to swap before they ended.
This was referenced Nov 23, 2026
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.
Part of #752, item 3. TEST-55-OOMD does not pass 3 times of 3 yet. See "What still fails".
What changes
memory.high, formemory.maxand for a system that is short of memory counts as a memory stall in the pressure (PSI) of its cgroup, aspsi_memstall_enterof Linux. A read of a page back from swap at a fault counts too, asswap_read_folioof Linux. Before, the full avg10 of the workload slice stayed at 0 and systemd-oomd did not kill.walk_page_rangeof Linux. It skips for up to 1 second an address space that had no page to give at the last look.memory.hightakes back pages and makes its threads wait once for each batch of 64 pages that it charged over the limit (MEMCG_CHARGE_BATCH), and a thread takes back only the pages that its cgroup charged over the limit (memcg_nr_pages_over_high).submit_bio_wait. Before, they spun on the lock of the disk driver.memory.highat its return to user mode, and its fault does not reclaim or call the OOM killer, as Linux delivers the fatal signal beforemem_cgroup_handle_over_highandout_of_memorygives true for a task intask_will_free_mem.The causes of the failures
memory.highdid not count inmemory.pressure.systemctl startfor 25 seconds. The 10 workers ofstress-ng --vm 10 --vm-bytes 200Mwere overmemory.high, and each return to user mode walked all 200 MiB in the kernel. The kernel is not preemptive, so with 2 vCPUs PID1 did not get a CPU.testchill.servicewas killed after the kill oftestmunch.service(exit 24 intestcase_preference_avoidandtestcase_basic_user, exit 23 intestcase_duration_override). systemd-oomd waits 15 seconds after a kill and then looks at the pressure again.testbloat.servicekeeps the pressure of the workload slice high, so the test must see thattestmunchstopped and then seetestchillin less than these 15 seconds. The killed workers took 17 to 38 seconds to exit, because each return to user mode wrote at least 64 pages to swap and the swap writes spun on the disk lock. The changes above make this much shorter, but it is not always short enough: in a debug run the killed workers took 8 seconds to exit and asystemctl statustook 20 seconds.Tests
TEST-55-OOMD of systemd 257 on x86_64, release kernel, 2 vCPUs and 1 GiB of memory, on server1. A run counts only if the host load stays at 8 or less and MemAvailable stays at 1.5 GB or more. All runs are counted runs.
basic_system and duration_analyze pass in each run.
What still fails
The test cases pass in about 1 run of 3. The failures are races with time limits of the test, and the system is too slow under the load of
stress-ng:testmunch, the test does not seetestchillin the 15 seconds before the next kill of systemd-oomd (exit 24 or 23). The killed workers take up to 8 seconds to exit, andsystemctl statustakes up to 20 seconds, while the 10 workers oftestbloatkeep both vCPUs busy.testmunchfor its own pressure (over 60% for 3 seconds) before the secondoomctloftestcase_duration_override, sooomctl | grep -A 2 testmunchfound nothing.The next step is the latency of user tasks when 20 threads reclaim: the kernel is not preemptive, so a thread in the reclaim keeps its CPU, and there is no group scheduling of the CPU.
The full gate did not run.