mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 17:06:39 +09:00
The calculation for used memory in oomd_system_context_acquire is given by MemTotal - MemFree from /proc/meminfo. This is too strict of a calculation because it does not consider memory that is still available for starting new applictions without swapping (MemAvailable). As a result, systemd-oomd can start to kill processes before it is necessary. This is more apparent on systems with low swap space. Instead, compute 'used' memory as MemTotal - MemAvailable in oomd_system_context_acquire and procfs_memory_get (which is used by oomd_cgroup_context_acquire). And, rename oomd_mem_free_below to oomd_mem_available_below for clarity.