From: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
To: Maarten Lankhorst <dev@lankhorst.se>,
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,
Thadeu Lima de Souza Cascardo <cascardo@igalia.com>,
kernel-dev@igalia.com
Subject: [PATCH v2 0/3] cgroup/dmem: allow atomic irrestrictive writes to dmem.max
Date: Thu, 19 Mar 2026 18:22:41 -0300 [thread overview]
Message-ID: <20260319-dmem_max_ebusy-v2-0-b5ce97205269@igalia.com> (raw)
When writing to dmem.max, it was noticed that some writes did not take
effect, even though the write was successful.
It turns out that page_counter_set_max checks if the new max value is above
the current usage and returns -EBUSY in case it is, which was being ignored
by dmemcg_limit_write.
It was also noticed that when setting limits for multiple regions in a
single write, while setting one region's limit may fail, others might have
succeeded before. Tejun Heo brought up that this breaks atomicity.
Maarten Lankhorst and Michal Koutný have brought up that instead of
failing, setting max below the current usage should behave like memcg and
start eviction until usage goes below the new max.
However, since there is no current mechanism to evict a given region, they
suggest that setting the new max will at least prevent further allocations.
v1 kept the multiple region support when writing to limit files, while
returning -EBUSY as soon as setting a region's max was above the usage.
This version (v2) only allows setting a single region limit per write,
while allowing any new max to be set.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
---
Changes in v2:
- Remove support for setting multiple regions' limits.
- Allow any new max limit to be set.
- Link to v1: https://lore.kernel.org/r/20260318-dmem_max_ebusy-v1-1-b7e461157b29@igalia.com
---
Thadeu Lima de Souza Cascardo (3):
cgroup/dmem: remove region parameter from dmemcg_parse_limit
cgroup/dmem: accept a single region when writing to attributes
cgroup/dmem: allow max to be set below current usage
kernel/cgroup/dmem.c | 74 +++++++++++++++++++++++-----------------------------
1 file changed, 32 insertions(+), 42 deletions(-)
---
base-commit: f338e77383789c0cae23ca3d48adcc5e9e137e3c
change-id: 20260318-dmem_max_ebusy-bfd33564f2c3
Best regards,
--
Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
next reply other threads:[~2026-03-19 21:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 21:22 Thadeu Lima de Souza Cascardo [this message]
2026-03-19 21:22 ` [PATCH v2 1/3] cgroup/dmem: remove region parameter from dmemcg_parse_limit Thadeu Lima de Souza Cascardo
2026-03-21 18:08 ` Claude review: " Claude Code Review Bot
2026-03-19 21:22 ` [PATCH v2 2/3] cgroup/dmem: accept a single region when writing to attributes Thadeu Lima de Souza Cascardo
2026-03-21 18:08 ` Claude review: " Claude Code Review Bot
2026-03-19 21:22 ` [PATCH v2 3/3] cgroup/dmem: allow max to be set below current usage Thadeu Lima de Souza Cascardo
2026-03-21 18:08 ` Claude review: " Claude Code Review Bot
2026-03-21 18:08 ` Claude review: cgroup/dmem: allow atomic irrestrictive writes to dmem.max 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=20260319-dmem_max_ebusy-v2-0-b5ce97205269@igalia.com \
--to=cascardo@igalia.com \
--cc=cgroups@vger.kernel.org \
--cc=dev@lankhorst.se \
--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