1
0
mirror of https://github.com/systemd/systemd.git synced 2025-08-25 13:49:55 +03:00

unit: don't gc unit in oom queue

This is a follow-up for 8db998981a, and
follows a similar logic: a pending OOM event really trumps everything:
we should not GC a unit while it is pending.
This commit is contained in:
Lennart Poettering
2023-06-08 11:11:28 +02:00
parent 438874cb10
commit 935f80428f
2 changed files with 6 additions and 1 deletions

View File

@ -3319,6 +3319,8 @@ static int on_cgroup_oom_event(sd_event_source *s, void *userdata) {
}
(void) unit_check_oom(u);
unit_add_to_gc_queue(u);
return 0;
}

View File

@ -441,7 +441,10 @@ bool unit_may_gc(Unit *u) {
if (u->perpetual)
return false;
if (u->in_cgroup_empty_queue)
/* if we saw a cgroup empty event for this unit, stay around until we processed it so that we remove
* the empty cgroup if possible. Similar, process any pending OOM events if they are already queued
* before we release the unit. */
if (u->in_cgroup_empty_queue || u->in_cgroup_oom_queue)
return false;
if (sd_bus_track_count(u->bus_track) > 0)