From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/xe: Avoid shrinker reclaim from kswapd under fragmentation
Date: Tue, 05 May 2026 10:13:42 +1000 [thread overview]
Message-ID: <review-patch6-20260430182335.2132382-7-matthew.brost@intel.com> (raw)
In-Reply-To: <20260430182335.2132382-7-matthew.brost@intel.com>
Patch Review
**Overall:** The payoff patch that uses the helper from patch 4 in the Xe shrinker.
```c
if (nr_scanned >= nr_to_scan || !can_backup)
goto out;
+ if (ttm_bo_shrink_kswap_maybe_fragmented(sc->nid, sc->order))
+ goto out;
+
/* If we didn't wake before, try to do it now if needed. */
if (!runtime_pm)
```
**Concerns:**
- **Placement is significant:** The check is placed *after* purgeable object scanning (lines 228-233) but *before* the non-purgeable (active BO backup/eviction) walk (lines 243-248). This means purgeable objects will still be reclaimed under fragmentation, but active BOs won't be evicted. This is exactly the right design — purgeable objects are cheap to re-create, while evicting active BOs triggers the expensive rebind loop described in the cover letter.
- **Return value:** When this `goto out` triggers, the function returns either `freed` (if something was purged) or `SHRINK_STOP` (if `nr_scanned == 0`). Returning `SHRINK_STOP` tells the mm core to stop invoking this shrinker. This seems appropriate — the shrinker is saying "I can't help, don't call me again for this reclaim cycle."
- **No tracing/debugging:** When the shrinker bails out due to fragmentation, there's no trace event or debug print. For a heuristic that skips potentially useful reclaim, it would be valuable to have a trace point (even if behind `CONFIG_DEBUG` or xe's own debug flags) so developers can observe when this kicks in. Not a blocker, but worth considering.
- **Missing Reviewed-by:** Unlike patches 3 and 5, this patch has no Reviewed-by tag. Given it directly changes Xe shrinker behavior, getting Thomas Hellström's or Matthew Auld's review would strengthen it.
---
**Summary:** The series is well-structured and addresses a real problem with measurable results. The main areas for scrutiny are: (1) the `~__GFP_RECLAIM` change in patch 3 which suppresses kswapd wakeup — this is a stronger change than the commit message suggests, (2) the mm core changes (patches 1-2) need mm maintainer buy-in, and (3) the fragmentation heuristic is intentionally coarse which is fine for a first iteration but could benefit from being compared against the beneficial_order rather than just `order != 0`.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-05 0:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 18:23 [PATCH v3 0/6] mm, drm/ttm, drm/xe: Avoid reclaim/eviction loops under fragmentation Matthew Brost
2026-04-30 18:23 ` [PATCH v3 1/6] mm: Wire up order in shrink_control Matthew Brost
2026-05-05 0:13 ` Claude review: " Claude Code Review Bot
2026-04-30 18:23 ` [PATCH v3 2/6] mm: Introduce zone_maybe_fragmented_in_shrinker() Matthew Brost
2026-05-05 0:13 ` Claude review: " Claude Code Review Bot
2026-04-30 18:23 ` [PATCH v3 3/6] drm/ttm: Issue direct reclaim at beneficial_order Matthew Brost
2026-05-05 0:13 ` Claude review: " Claude Code Review Bot
2026-04-30 18:23 ` [PATCH v3 4/6] drm/ttm: Introduce ttm_bo_shrink_kswap_maybe_fragmented() Matthew Brost
2026-05-05 0:13 ` Claude review: " Claude Code Review Bot
2026-04-30 18:23 ` [PATCH v3 5/6] drm/xe: Set TTM device beneficial_order to 9 (2M) Matthew Brost
2026-05-05 0:13 ` Claude review: " Claude Code Review Bot
2026-04-30 18:23 ` [PATCH v3 6/6] drm/xe: Avoid shrinker reclaim from kswapd under fragmentation Matthew Brost
2026-05-05 0:13 ` Claude Code Review Bot [this message]
2026-05-05 0:13 ` Claude review: mm, drm/ttm, drm/xe: Avoid reclaim/eviction loops " Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-04-30 19:18 [PATCH v4 0/6] " Matthew Brost
2026-04-30 19:18 ` [PATCH v4 6/6] drm/xe: Avoid shrinker reclaim from kswapd " Matthew Brost
2026-05-05 0:00 ` Claude review: " Claude Code Review Bot
2026-04-21 1:26 [PATCH 0/3] drm/ttm, drm/xe: Avoid reclaim/eviction loops " Matthew Brost
2026-04-21 1:26 ` [PATCH 3/3] drm/xe: Avoid shrinker reclaim from kswapd " Matthew Brost
2026-04-22 23:01 ` 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-patch6-20260430182335.2132382-7-matthew.brost@intel.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