]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/cgroup: Add OOM check
authorNishal Kulkarni <nishalkulkarni@gmail.com>
Mon, 7 Mar 2022 10:11:05 +0000 (15:41 +0530)
committerNishal Kulkarni <nishalkulkarni@gmail.com>
Mon, 21 Mar 2022 19:22:35 +0000 (00:52 +0530)
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)

src/core/cgroup.c

index dda87db7e17e004c9c18b8b7115075b8ed2da955..f3b124eb67ffd6f0750b22f8e056fa735a8e6a3b 100644 (file)
@@ -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)