public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: mm/page_counter: decouple peak_reset from peak_write
Date: Thu, 07 May 2026 13:37:55 +1000	[thread overview]
Message-ID: <review-patch1-20260506-dmem_peak-v1-1-8d803eb3449c@igalia.com> (raw)
In-Reply-To: <20260506-dmem_peak-v1-1-8d803eb3449c@igalia.com>

Patch Review

This patch extracts the core peak-reset logic from `peak_write()` in `mm/memcontrol.c` into a new shared `of_peak_reset()` helper in `kernel/cgroup/cgroup.c`, and refactors the memcontrol callers to use it.

**Correctness: Good.** The extracted function is a faithful copy of the original logic. Both `memory_peak_write()` and `swap_peak_write()` now inline the lock acquire/release around the shared helper, maintaining identical locking semantics.

**Minor issues:**

1. **Subject prefix mismatch:** The commit title says `mm/page_counter:` but the new function is added to `kernel/cgroup/cgroup.c`, not to `mm/page_counter.c`. A more accurate prefix would be `cgroup:` or `mm/memcontrol:` since the refactoring touches `mm/memcontrol.c` and `kernel/cgroup/cgroup.c`.

2. **Header dependency added to `cgroup-defs.h`:**
   ```c
   +#include <linux/page_counter.h>
   ```
   `cgroup-defs.h` is included very widely. Adding `page_counter.h` there pulls the `page_counter` struct definition into every compilation unit that includes cgroup headers. Consider whether a forward declaration or moving the `of_peak_reset()` declaration to a separate header (e.g., `page_counter.h` itself) would be cleaner. The cgroup-defs.h header is included from sched.h paths, so this could have non-trivial build-time impact.

3. **The `of_peak_reset()` function docstring** is well-written and accurately describes the contract. The requirement that "a lock must be used to protect @watchers" is correctly documented.

4. **No `EXPORT_SYMBOL` for `of_peak_reset()`:** This is fine if `CONFIG_CGROUP_DMEM` is `bool` (built-in only), but worth verifying. If dmem can ever be built as a module, this would need an export.

**The refactoring is clean and preserves behavior.** No concerns about the functional changes.

---

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-07  3:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 11:58 [PATCH 0/2] cgroup/dmem: introduce a peak file Thadeu Lima de Souza Cascardo
2026-05-06 11:58 ` [PATCH 1/2] mm/page_counter: decouple peak_reset from peak_write Thadeu Lima de Souza Cascardo
2026-05-07  3:37   ` Claude Code Review Bot [this message]
2026-05-06 11:58 ` [PATCH 2/2] cgroup/dmem: introduce a peak file Thadeu Lima de Souza Cascardo
2026-05-07  3:37   ` Claude review: " Claude Code Review Bot
2026-05-06 13:53 ` [PATCH 0/2] " Michal Koutný
2026-05-06 14:18   ` Thadeu Lima de Souza Cascardo
2026-05-06 15:09     ` Michal Koutný
2026-05-07  3:37 ` Claude review: " 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-20260506-dmem_peak-v1-1-8d803eb3449c@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