diff --git a/src/oom/oomd-manager.c b/src/oom/oomd-manager.c index c43e1bc5d1..b2142dd43c 100644 --- a/src/oom/oomd-manager.c +++ b/src/oom/oomd-manager.c @@ -539,20 +539,20 @@ static int monitor_memory_pressure_contexts_handler(sd_event_source *s, uint64_t return log_oom(); if (r < 0) log_error_errno(r, "Failed to select any cgroups under %s based on pressure, ignoring: %m", t->path); + else if (r == 0) + /* Already queued for kill by an earlier iteration, try next target without + * resetting the delay timer. */ + continue; else { - /* Don't act on all the high pressure cgroups at once; return as soon as we kill one. - * If r == 0 then the cgroup is already queued for kill by an earlier iteration. - * In either case, go through the event loop again and select a new candidate if - * pressure is still high. */ + /* Don't act on all the high pressure cgroups at once; return as soon as we kill one. */ m->mem_pressure_post_action_delay_start = usec_now; - if (selected && r > 0) { + if (selected) log_notice("Marked %s for killing due to memory pressure for %s being %lu.%02lu%% > %lu.%02lu%%" " for > %s with reclaim activity", selected->path, t->path, LOADAVG_INT_SIDE(t->memory_pressure.avg10), LOADAVG_DECIMAL_SIDE(t->memory_pressure.avg10), LOADAVG_INT_SIDE(t->mem_pressure_limit), LOADAVG_DECIMAL_SIDE(t->mem_pressure_limit), FORMAT_TIMESPAN(t->mem_pressure_duration_usec, USEC_PER_SEC)); - } return 0; } }