From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/ttm: Be more aggressive when allocating below protection limit Date: Tue, 03 Mar 2026 13:29:39 +1000 Message-ID: In-Reply-To: <20260302-dmemcg-aggressive-protect-v5-5-ffd3a2602309@gmx.de> References: <20260302-dmemcg-aggressive-protect-v5-0-ffd3a2602309@gmx.de> <20260302-dmemcg-aggressive-protect-v5-5-ffd3a2602309@gmx.de> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Purpose:** The core behavioral change. When an allocation is covered by c= group protection (below min/low), attempt eviction of unprotected buffers i= nstead of backing off to GTT. **Logic analysis:** ```c may_evict |=3D dmem_cgroup_below_min(NULL, alloc_state->charge_pool); below_low =3D dmem_cgroup_below_low(NULL, alloc_state->charge_pool); alloc_state->only_evict_unprotected =3D !may_evict && below_low; ``` This creates three tiers: 1. **Below min** (strongest): `may_evict` is forced true =E2=86=92 full evi= ction including low-protected BOs 2. **Below low but not min**: `only_evict_unprotected =3D true` =E2=86=92 e= vict only unprotected BOs 3. **Not protected**: No change from current behavior The `only_evict_unprotected` flag prevents the retry-with-low path: ```c if (!lret && evict_walk.hit_low && !state->only_evict_unprotected) { ``` This is correct =E2=80=94 when we're in "protected allocator" mode, we shou= ld not escalate to evicting low-protected BOs because those are peers that = deserve their protection. The extended comment block explaining the protection model is excellent and= makes the reasoning very clear. The condition `(may_evict || below_low)` for converting `-ENOSPC` to `-EBUS= Y`: ```c if (ret =3D=3D -ENOSPC && (may_evict || below_low)) ret =3D -EBUSY; ``` ensures eviction is attempted for any protected allocation. Note: `dmem_cgroup_below_min/low(NULL, ...)` uses global root for protectio= n calculation. This is correct for determining if the *allocator* is protec= ted. Patch 6 then handles the per-evictee calculation correctly using commo= n ancestors. --- Generated by Claude Code Patch Reviewer