[Devel] [PATCH hci-8.1 4/6] ms/cgroup/dmem: Return -ENOMEM on failed pool preallocation
Mirian Shilakadze
mirian.shilakadze at virtuozzo.com
Mon Nov 2 02:51:46 MSK 2026
From: Guopeng Zhang <zhangguopeng at kylinos.cn>
get_cg_pool_unlocked() handles allocation failures under dmemcg_lock by
dropping the lock, preallocating a pool with GFP_KERNEL, and retrying the
locked lookup and creation path.
If the fallback allocation fails too, pool remains NULL. Since the loop
condition is while (!pool), the function can keep retrying instead of
propagating the allocation failure to the caller.
Set pool to ERR_PTR(-ENOMEM) when the fallback allocation fails so the
loop exits through the existing common return path. The callers already
handle ERR_PTR() from get_cg_pool_unlocked(), so this restores the
expected error path.
Fixes: b168ed458dde ("kernel/cgroup: Add "dmem" memory accounting cgroup")
Cc: stable at vger.kernel.org # v6.14+
Signed-off-by: Guopeng Zhang <zhangguopeng at kylinos.cn>
Signed-off-by: Tejun Heo <tj at kernel.org>
(cherry picked from commit 796ad622040f7f955ccc3973085e953415920496)
https://virtuozzo.atlassian.net/browse/VSTOR-152813
Signed-off-by: Mirian Shilakadze <mirian.shilakadze at virtuozzo.com>
---
kernel/cgroup/dmem.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/cgroup/dmem.c b/kernel/cgroup/dmem.c
index c8cfa5f3bd43..8424df801bc0 100644
--- a/kernel/cgroup/dmem.c
+++ b/kernel/cgroup/dmem.c
@@ -601,6 +601,7 @@ get_cg_pool_unlocked(struct dmemcg_state *cg, struct dmem_cgroup_region *region)
pool = NULL;
continue;
}
+ pool = ERR_PTR(-ENOMEM);
}
}
--
2.43.0
More information about the Devel
mailing list