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: introduce a peak file Date: Sat, 16 May 2026 11:20:49 +1000 Message-ID: In-Reply-To: <20260513-dmem_peak-v2-1-dac06999db9e@igalia.com> References: <20260513-dmem_peak-v2-1-dac06999db9e@igalia.com> <20260513-dmem_peak-v2-1-dac06999db9e@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 **Approach:** The patch adds a `get_resource_peak()` getter that reads `poo= l->cnt.watermark`, a `dmem_cgroup_region_peak_show()` display function, and= a cftype entry =E2=80=94 all following the exact same pattern as `get_reso= urce_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 pa= ttern documented in the page counter code. 2. The null check (`pool ? ... : 0`) mirrors `get_resource_current()` exact= ly. 3. `CFTYPE_NOT_ON_ROOT` is the correct flag =E2=80=94 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 t= he 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`, s= o the asymmetry is intentional and correct. 2. **No write/reset support.** The commit message and documentation say "re= ad-only for now," which is fine for an initial version. The `memory.peak` c= ontroller has grown `peak_open`/`peak_release`/`memory_peak_write` for per-= fd local watermark tracking and reset support. If that's planned as a follo= w-up, it might be worth mentioning in the commit message for future referen= ce, but this is a nit =E2=80=94 the v1=E2=86=92v2 changelog already documen= ts the deliberate decision to start read-only. 3. **Documentation placement is correct.** The `dmem.peak` entry is inserte= d between `dmem.max/min/low` and `dmem.capacity`, which is a natural locati= on grouping the per-cgroup files together before the root-only `dmem.capaci= ty`. 4. **Watermark initialization.** The `page_counter_init()` function zeroes = `usage` and sets `max` but does not explicitly initialize `watermark` or `l= ocal_watermark`. Since `page_counter` structs in `dmem_cgroup_pool_state` a= re 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 w= orth noting for anyone reading the patch. **No functional issues found.** The patch is a straightforward, correct ext= ension of the existing dmem cgroup interface. --- Generated by Claude Code Patch Reviewer