diff --git a/src/oom/oomd-util.c b/src/oom/oomd-util.c index 340d2bb60e..97803a8428 100644 --- a/src/oom/oomd-util.c +++ b/src/oom/oomd-util.c @@ -494,6 +494,14 @@ int oomd_cgroup_kill_mark(Manager *m, OomdCGroupContext *ctx) { r = set_ensure_put(&m->kill_states, &oomd_kill_state_hash_ops, ks); if (r < 0) return log_oom_debug(); + if (r == 0) { + /* The cgroup is already queued. Drop only this temporary object, because running the normal + * cleanup path would remove by cgroup path key and could interfere with the existing queued + * kill state. */ + oomd_cgroup_context_unref(ks->ctx); + ks = mfree(ks); + return 0; + } r = oomd_prekill_hook(m, ks); if (r < 0)