From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: cgroup/dmem: accept a single region when writing to attributes
Date: Sun, 22 Mar 2026 04:08:56 +1000 [thread overview]
Message-ID: <review-patch2-20260319-dmem_max_ebusy-v2-2-b5ce97205269@igalia.com> (raw)
In-Reply-To: <20260319-dmem_max_ebusy-v2-2-b5ce97205269@igalia.com>
Patch Review
**Verdict: Good, minor observations**
This replaces the `while` loop that iterated over newline-separated regions with a flat single-region parse. The motivation (lack of atomicity when multiple regions could partially succeed) is valid.
The control flow is clean. One observation:
- After `strstrip(buf)` at line 737, the `strsep(&buf, " \t")` call at line 741 will always return a non-empty string if `buf[0]` was non-zero (checked at line 738), so the `!region_name[0]` check at line 742 is technically redundant but harmless as defensive coding.
- The `out_put` label correctly drops the region ref via `kref_put`. The early returns before the region lookup don't need ref cleanup, and the error path after `get_cg_pool_unlocked` correctly jumps to `out_put`. The refcounting is correct.
- **Minor nit**: The patch doesn't strip a trailing newline before parsing. If userspace writes `"region_name 1024\n"`, `strstrip()` at the top handles that. But if input is `"region_name 1024\n\n"` or `"region_name 1024\nother_region 2048\n"`, the `memparse` in `dmemcg_parse_limit` would hit the `\n` and return `-EINVAL` via `*end != '\0'`. This is the desired behavior (rejecting multi-region input), but it would be slightly more user-friendly to strip trailing whitespace from `buf` after `skip_spaces`. In practice `strstrip` already strips trailing whitespace from the entire buffer, so this is fine — `buf` after `strsep` points past the separator, and `skip_spaces` handles leading whitespace, while `strstrip` already trimmed trailing whitespace from the whole original buffer. No issue here.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-21 18:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 21:22 [PATCH v2 0/3] cgroup/dmem: allow atomic irrestrictive writes to dmem.max Thadeu Lima de Souza Cascardo
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 Code Review Bot [this message]
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=review-patch2-20260319-dmem_max_ebusy-v2-2-b5ce97205269@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