Re: [PATCH] cgroup/dmem: return error when failing to set dmem.max

From: Michal Koutný

Date: Thu Mar 19 2026 - 05:50:48 EST


On Thu, Mar 19, 2026 at 08:33:12AM +0100, Maarten Lankhorst <dev@xxxxxxxxxxxx> wrote:
> The semantics of dmemcg should not substantially differ from the memory cgroup
> controller. I believe the memory cgroup controller does allow setting a lower
> max, and will evict until below the new max.
>
> See mm/memcontrol.c:memory_max_write
>
> We should probably do the same in dmemcg instead, although we currently have no
> mechanism to evict, setting a new lower max at least prevents future allocations
> from failing.

+1

Yes, if the dmem resource is preemptible, the limit decrement should take an
action to fullfill the limit (like with memory.max).
Even as non-preemptible resource, the behavior could be more consistent
with misc controller that allows "storing" any value (with the effect of
preventing further growth).

Thanks,
Michal

Attachment: signature.asc
Description: PGP signature