]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
oom: skip over cgroups with no memory usage
authorAnita Zhang <the.anitazha@gmail.com>
Thu, 28 Jan 2021 23:47:26 +0000 (15:47 -0800)
committerAnita Zhang <the.anitazha@gmail.com>
Tue, 9 Feb 2021 09:30:05 +0000 (01:30 -0800)
src/oom/oomd-util.c

index 8f138d64c6ccef801d0dd1d516d28ac82657682f..fa8b8b70b19fbb3676363a97225162aa277fa6e3 100644 (file)
@@ -219,7 +219,8 @@ int oomd_kill_by_pgscan(Hashmap *h, const char *prefix, bool dry_run) {
                 return r;
 
         for (int i = 0; i < r; i++) {
-                if (sorted[i]->pgscan == 0)
+                /* Skip cgroups with no reclaim and memory usage; it won't alleviate pressure */
+                if (sorted[i]->pgscan == 0 && sorted[i]->current_memory_usage == 0)
                         break;
 
                 r = oomd_cgroup_kill(sorted[i]->path, true, dry_run);