From: Nishal Kulkarni Date: Mon, 7 Mar 2022 10:11:05 +0000 (+0530) Subject: core/cgroup: Add OOM check X-Git-Tag: v251-rc1~65^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f7829525be46ddeddcbac39d7f31b12fae52cb5e;p=thirdparty%2Fsystemd.git core/cgroup: Add OOM check Check if process(es) of a cgroup were killed by Kernel OOM killer or systemd-oomd before we send the cgroup empty notification. This allows us to show the right exit state(ServiceResult) --- diff --git a/src/core/cgroup.c b/src/core/cgroup.c index dda87db7e17..f3b124eb67f 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -2958,6 +2958,10 @@ static int on_cgroup_empty_event(sd_event_source *s, void *userdata) { log_debug_errno(r, "Failed to reenable cgroup empty event source, ignoring: %m"); } + /* Update state based on OOM kills before we notify about cgroup empty event */ + (void) unit_check_oom(u); + (void) unit_check_oomd_kill(u); + unit_add_to_gc_queue(u); if (UNIT_VTABLE(u)->notify_cgroup_empty)