Linux 6.9-rc1
[linux-2.6-microblaze.git] / mm / swap_cgroup.c
index 5a94429..db6c4a2 100644 (file)
@@ -170,6 +170,9 @@ int swap_cgroup_swapon(int type, unsigned long max_pages)
        unsigned long length;
        struct swap_cgroup_ctrl *ctrl;
 
+       if (mem_cgroup_disabled())
+               return 0;
+
        length = DIV_ROUND_UP(max_pages, SC_PER_PAGE);
 
        array = vcalloc(length, sizeof(void *));
@@ -204,6 +207,9 @@ void swap_cgroup_swapoff(int type)
        unsigned long i, length;
        struct swap_cgroup_ctrl *ctrl;
 
+       if (mem_cgroup_disabled())
+               return;
+
        mutex_lock(&swap_cgroup_mutex);
        ctrl = &swap_cgroup_ctrl[type];
        map = ctrl->map;