From: Maarten Lankhorst <dev@lankhorst.se>
To: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>,
Maxime Ripard <mripard@kernel.org>,
Natalie Vock <natalie.vock@gmx.de>, Tejun Heo <tj@kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Koutný <mkoutny@suse.com>
Cc: cgroups@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, kernel-dev@igalia.com
Subject: Re: [PATCH] cgroup/dmem: return error when failing to set dmem.max
Date: Thu, 19 Mar 2026 08:33:12 +0100 [thread overview]
Message-ID: <02c0752a-1a66-4938-9f5e-152c8c98741f@lankhorst.se> (raw)
In-Reply-To: <20260318-dmem_max_ebusy-v1-1-b7e461157b29@igalia.com>
Hey,
Den 2026-03-18 kl. 20:34, skrev Thadeu Lima de Souza Cascardo:
> 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.
>
> Return as soon as setting one of the regions max limit fails. This keeps
> with the current behavior of returning when one of the region names is not
> valid.
>
> After this fix, setting a max value below the current value returns -EBUSY.
>
> # cat dmem.current
> drm/0000:04:00.0/vram 1060864
> # echo drm/0000:04:00.0/vram 0 > dmem.max
> -bash: echo: write error: Device or resource busy
> #
>
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
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.
I believe we should have a similar loop in dmemcg, and allow ttm to evict until
the new max is reached.
Kind regards,
~Maarten Lankhorst
next prev parent reply other threads:[~2026-03-19 7:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-18 19:34 [PATCH] cgroup/dmem: return error when failing to set dmem.max Thadeu Lima de Souza Cascardo
2026-03-18 22:56 ` Tejun Heo
2026-03-19 7:33 ` Maarten Lankhorst [this message]
2026-03-19 9:40 ` Michal Koutný
2026-03-21 19:01 ` Claude review: " Claude Code Review Bot
2026-03-21 19:01 ` Claude Code Review Bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=02c0752a-1a66-4938-9f5e-152c8c98741f@lankhorst.se \
--to=dev@lankhorst.se \
--cc=cascardo@igalia.com \
--cc=cgroups@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-dev@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mkoutny@suse.com \
--cc=mripard@kernel.org \
--cc=natalie.vock@gmx.de \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox