From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot 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 Message-ID: In-Reply-To: <20260506-dmem_peak-v1-1-8d803eb3449c@igalia.com> References: <20260506-dmem_peak-v1-0-8d803eb3449c@igalia.com> <20260506-dmem_peak-v1-1-8d803eb3449c@igalia.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 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 ``` `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