]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
oom: wrap reply.path with empty_to_root
authorAnita Zhang <the.anitazha@gmail.com>
Fri, 5 Feb 2021 11:00:11 +0000 (03:00 -0800)
committerAnita Zhang <the.anitazha@gmail.com>
Tue, 9 Feb 2021 09:23:58 +0000 (01:23 -0800)
src/oom/oomd-manager.c

index 338935b3ec6681a43940f4742a2caa7d3f375281..825fe38e189d277a4632a956cd44513f8e0ffb2f 100644 (file)
@@ -93,7 +93,7 @@ static int process_managed_oom_reply(
                                 m->monitored_swap_cgroup_contexts : m->monitored_mem_pressure_cgroup_contexts;
 
                 if (reply.mode == MANAGED_OOM_AUTO) {
-                        (void) oomd_cgroup_context_free(hashmap_remove(monitor_hm, reply.path));
+                        (void) oomd_cgroup_context_free(hashmap_remove(monitor_hm, empty_to_root(reply.path)));
                         continue;
                 }
 
@@ -109,7 +109,7 @@ static int process_managed_oom_reply(
                         }
                 }
 
-                ret = oomd_insert_cgroup_context(NULL, monitor_hm, reply.path);
+                ret = oomd_insert_cgroup_context(NULL, monitor_hm, empty_to_root(reply.path));
                 if (ret == -ENOMEM) {
                         r = ret;
                         goto finish;
@@ -117,7 +117,7 @@ static int process_managed_oom_reply(
 
                 /* Always update the limit in case it was changed. For non-memory pressure detection the value is
                  * ignored so always updating it here is not a problem. */
-                ctx = hashmap_get(monitor_hm, reply.path);
+                ctx = hashmap_get(monitor_hm, empty_to_root(reply.path));
                 if (ctx)
                         ctx->mem_pressure_limit = limit;
         }