From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: cgroup/dmem: introduce a peak file
Date: Sat, 16 May 2026 11:20:49 +1000 [thread overview]
Message-ID: <review-patch1-20260513-dmem_peak-v2-1-dac06999db9e@igalia.com> (raw)
In-Reply-To: <20260513-dmem_peak-v2-1-dac06999db9e@igalia.com>
Patch Review
**Approach:** The patch adds a `get_resource_peak()` getter that reads `pool->cnt.watermark`, a `dmem_cgroup_region_peak_show()` display function, and a cftype entry — all following the exact same pattern as `get_resource_current()` / `dmem_cgroup_region_current_show()`.
**Positive:**
1. The `READ_ONCE` usage in `get_resource_peak()` is correct and consistent with how `page_counter_charge()` in `mm/page_counter.c` uses `WRITE_ONCE` to update the watermark. This is the same deliberate-racy-but-acceptable pattern documented in the page counter code.
2. The null check (`pool ? ... : 0`) mirrors `get_resource_current()` exactly.
3. `CFTYPE_NOT_ON_ROOT` is the correct flag — this matches `memory.peak` in the memory controller and is consistent with how `dmem.min`, `dmem.low`, and `dmem.max` are configured.
**Observations:**
1. **`current` lacks `CFTYPE_NOT_ON_ROOT` but `peak` has it.** Looking at the existing tree, `dmem.current` does *not* set `CFTYPE_NOT_ON_ROOT`, so it appears on root. The new `dmem.peak` does set `CFTYPE_NOT_ON_ROOT`, so it won't appear on root. This is consistent with how `memory.current` (no flag) and `memory.peak` (has `CFTYPE_NOT_ON_ROOT`) work in `mm/memcontrol.c`, so the asymmetry is intentional and correct.
2. **No write/reset support.** The commit message and documentation say "read-only for now," which is fine for an initial version. The `memory.peak` controller has grown `peak_open`/`peak_release`/`memory_peak_write` for per-fd local watermark tracking and reset support. If that's planned as a follow-up, it might be worth mentioning in the commit message for future reference, but this is a nit — the v1→v2 changelog already documents the deliberate decision to start read-only.
3. **Documentation placement is correct.** The `dmem.peak` entry is inserted between `dmem.max/min/low` and `dmem.capacity`, which is a natural location grouping the per-cgroup files together before the root-only `dmem.capacity`.
4. **Watermark initialization.** The `page_counter_init()` function zeroes `usage` and sets `max` but does not explicitly initialize `watermark` or `local_watermark`. Since `page_counter` structs in `dmem_cgroup_pool_state` are allocated with `kzalloc` (which zero-initializes), the watermark starts at 0, which is correct for a "max seen so far" semantic. This is fine but worth noting for anyone reading the patch.
**No functional issues found.** The patch is a straightforward, correct extension of the existing dmem cgroup interface.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-16 1:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 18:58 [PATCH v2] cgroup/dmem: introduce a peak file Thadeu Lima de Souza Cascardo
2026-05-13 20:44 ` Tejun Heo
2026-05-16 1:20 ` Claude Code Review Bot [this message]
2026-05-16 1:20 ` Claude review: " Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-05-14 17:36 [PATCH v3] " Thadeu Lima de Souza Cascardo
2026-05-16 0:32 ` Claude review: " Claude Code Review Bot
2026-05-16 0:32 ` Claude Code Review Bot
2026-05-06 11:58 [PATCH 0/2] " Thadeu Lima de Souza Cascardo
2026-05-06 11:58 ` [PATCH 2/2] " Thadeu Lima de Souza Cascardo
2026-05-07 3:37 ` Claude review: " Claude Code Review Bot
2026-05-07 3:37 ` 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-patch1-20260513-dmem_peak-v2-1-dac06999db9e@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