From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot 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 Message-ID: In-Reply-To: <20260318-dmem_max_ebusy-v1-1-b7e461157b29@igalia.com> References: <20260318-dmem_max_ebusy-v1-1-b7e461157b29@igalia.com> <20260318-dmem_max_ebusy-v1-1-b7e461157b29@igalia.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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_co= unter.h:86`), and can return `-EBUSY`. Propagating this is the right thing = to do. **Signature change is appropriate:** Changing the `apply` callback from `vo= id (*apply)(...)` to `int (*apply)(...)` and updating `set_resource_min`/`s= et_resource_low` to return `0` is a clean way to handle this uniformly. **Potential issue =E2=80=94 partial application on multi-region writes:** L= ooking 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 si= ngle write (multiple lines), an error from `apply()` on one region will sto= p processing subsequent regions. The commit message acknowledges this ("Ret= urn as soon as setting one of the regions max limit fails"). However, consi= der that **regions processed before the failing one have already been commi= tted** =E2=80=94 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 =E2=80=94 `err` after `apply` vs `goto out_put`:** Looking at = the patched code: ```c err =3D 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_poo= l_put(pool)` and `kref_put()` before the `while` loop condition `!err` term= inates the loop. This is correct =E2=80=94 no resource leak. **Nit =E2=80=94 `set_resource_min` and `set_resource_low`:** `page_counter_= set_min()` and `page_counter_set_low()` are `void` functions, so wrapping t= hem 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.=20 Reviewed-by quality: **Good to go**, no blocking issues. --- Generated by Claude Code Patch Reviewer