From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: cgroup/dmem: return error when failing to set dmem.max
Date: Sun, 22 Mar 2026 05:01:52 +1000 [thread overview]
Message-ID: <review-patch1-20260318-dmem_max_ebusy-v1-1-b7e461157b29@igalia.com> (raw)
In-Reply-To: <20260318-dmem_max_ebusy-v1-1-b7e461157b29@igalia.com>
Patch Review
**Correctness of the core fix:** The key change at line 121 of the diff is correct:
```c
- page_counter_set_max(&pool->cnt, val);
+ return page_counter_set_max(&pool->cnt, val);
```
`page_counter_set_max()` returns `int` (confirmed at `include/linux/page_counter.h:86`), and can return `-EBUSY`. Propagating this is the right thing to do.
**Signature change is appropriate:** Changing the `apply` callback from `void (*apply)(...)` to `int (*apply)(...)` and updating `set_resource_min`/`set_resource_low` to return `0` is a clean way to handle this uniformly.
**Potential issue — partial application on multi-region writes:** Looking at the loop in `dmemcg_limit_write()` (line 734 of the existing code: `while (buf && !err)`), when a user writes multiple region limits in a single write (multiple lines), an error from `apply()` on one region will stop processing subsequent regions. The commit message acknowledges this ("Return as soon as setting one of the regions max limit fails"). However, consider that **regions processed before the failing one have already been committed** — the function does not roll back previously applied limits. This is a pre-existing pattern (same happens for parse errors), but worth noting that the semantics are "apply until first failure" with no rollback.
**Minor note — `err` after `apply` vs `goto out_put`:** Looking at the patched code:
```c
err = apply(pool, new_limit);
dmemcg_pool_put(pool);
out_put:
kref_put(®ion->ref, dmemcg_free_region);
```
When `apply()` returns an error, the code still correctly calls `dmemcg_pool_put(pool)` and `kref_put()` before the `while` loop condition `!err` terminates the loop. This is correct — no resource leak.
**Nit — `set_resource_min` and `set_resource_low`:** `page_counter_set_min()` and `page_counter_set_low()` are `void` functions, so wrapping them with `return 0` is fine. If these ever gain error returns in the future, this patch has already set up the plumbing to handle it. No issue here.
**Verdict:** The patch looks correct and ready to apply. The fix is minimal and appropriate.
Reviewed-by quality: **Good to go**, no blocking issues.
---
Generated by Claude Code Patch Reviewer
prev parent reply other threads:[~2026-03-21 19:01 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
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 [this message]
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=review-patch1-20260318-dmem_max_ebusy-v1-1-b7e461157b29@igalia.com \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.com \
/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