page_counter_set_max may return -EBUSY in case the current usage is above the new max. When writing to dmem.max, this error is ignored and the new max is not set.
Instead of using page_counter_set_max when writing to dmem.max, atomically update its value irrespective of the current usage. Since there is no current mechanism to evict a given dmemcg pool, this will at least prevent the current usage from growing any further. Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]> --- kernel/cgroup/dmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/cgroup/dmem.c b/kernel/cgroup/dmem.c index 695d2b7516081256da030c80b54ec1c5fcd6ca16..bf9e0d11e46156a437196c77fdfde84250e65420 100644 --- a/kernel/cgroup/dmem.c +++ b/kernel/cgroup/dmem.c @@ -159,7 +159,7 @@ set_resource_low(struct dmem_cgroup_pool_state *pool, u64 val) static void set_resource_max(struct dmem_cgroup_pool_state *pool, u64 val) { - page_counter_set_max(&pool->cnt, val); + xchg(&pool->cnt.max, val); } static u64 get_resource_low(struct dmem_cgroup_pool_state *pool) -- 2.47.3
