Compare commits

..

2 Commits

Author SHA1 Message Date
slee649 f91e7f9706
Merge 84b25bf0b4 into 321c202e7c 2024-11-26 05:29:09 +00:00
Sea-Eun Lee 84b25bf0b4 oomd: support reloading configuration at runtime 2024-11-26 05:28:55 +00:00
2 changed files with 5 additions and 2 deletions

View File

@ -74,6 +74,10 @@ int manager_parse_config_file(Manager *m) {
unsigned long l, f; unsigned long l, f;
int r; int r;
arg_swap_used_limit_permyriad = -1;
arg_mem_pressure_limit_permyriad = -1;
arg_mem_pressure_usec = DEFAULT_MEM_PRESSURE_DURATION_USEC;
static const ConfigTableItem items[] = { static const ConfigTableItem items[] = {
{ "OOM", "SwapUsedLimit", config_parse_permyriad, 0, &arg_swap_used_limit_permyriad }, { "OOM", "SwapUsedLimit", config_parse_permyriad, 0, &arg_swap_used_limit_permyriad },
{ "OOM", "DefaultMemoryPressureLimit", config_parse_permyriad, 0, &arg_mem_pressure_limit_permyriad }, { "OOM", "DefaultMemoryPressureLimit", config_parse_permyriad, 0, &arg_mem_pressure_limit_permyriad },

View File

@ -288,12 +288,11 @@ testcase_reload() {
mkdir -p /run/systemd/oomd.conf.d/ mkdir -p /run/systemd/oomd.conf.d/
{ {
echo "[OOM]" echo "[OOM]"
echo "SwapUsedLimit=90%"
echo "DefaultMemoryPressureLimit=60%"
echo "DefaultMemoryPressureDurationSec=2s" echo "DefaultMemoryPressureDurationSec=2s"
} >/run/systemd/oomd.conf.d/99-oomd-test.conf } >/run/systemd/oomd.conf.d/99-oomd-test.conf
systemctl reload systemd-oomd.service systemctl reload systemd-oomd.service
assert_in 'Swap Used Limit: 90.00%' "$(oomctl)" assert_in 'Swap Used Limit: 90.00%' "$(oomctl)"
assert_in 'Default Memory Pressure Limit: 60.00%' "$(oomctl)" assert_in 'Default Memory Pressure Limit: 60.00%' "$(oomctl)"
assert_in 'Default Memory Pressure Duration: 2s' "$(oomctl)" assert_in 'Default Memory Pressure Duration: 2s' "$(oomctl)"