diff --git a/man/oomd.conf.xml b/man/oomd.conf.xml index 6156c98fbd..0ae7e109b1 100644 --- a/man/oomd.conf.xml +++ b/man/oomd.conf.xml @@ -81,7 +81,7 @@ Sets the amount of time a unit's control group needs to have exceeded memory pressure limits before systemd-oomd will take action. Memory pressure limits are defined by DefaultMemoryPressureLimit= and ManagedOOMMemoryPressureLimit=. - Defaults to 30 seconds when this property is unset or set to 0. + Must be set to 0, or at least 1 second. Defaults to 30 seconds when unset or 0. diff --git a/src/oom/oomd.c b/src/oom/oomd.c index 6e2a5889d1..deb7b094d5 100644 --- a/src/oom/oomd.c +++ b/src/oom/oomd.c @@ -155,6 +155,9 @@ static int run(int argc, char *argv[]) { assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, -1) >= 0); + if (arg_mem_pressure_usec > 0 && arg_mem_pressure_usec < 1 * USEC_PER_SEC) + log_error_errno(SYNTHETIC_ERRNO(EINVAL), "DefaultMemoryPressureDurationSec= must be 0 or at least 1s"); + r = manager_new(&m); if (r < 0) return log_error_errno(r, "Failed to create manager: %m");