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: Use common ancestor of evictor and evictee as limit pool Date: Tue, 03 Mar 2026 13:29:39 +1000 Message-ID: In-Reply-To: <20260302-dmemcg-aggressive-protect-v5-6-ffd3a2602309@gmx.de> References: <20260302-dmemcg-aggressive-protect-v5-0-ffd3a2602309@gmx.de> <20260302-dmemcg-aggressive-protect-v5-6-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:** Uses the common ancestor of evictor and evictee as the root fo= r protection calculation, enabling correct behavior for sibling cgroup prio= ritization. **Self-eviction guard:** ```c if (evict_walk->alloc_state->only_evict_unprotected && bo->resource->css =3D=3D evict_walk->alloc_state->charge_pool) return 0; ``` This prevents a protected cgroup from evicting its own buffers during the "= only unprotected" pass. The pointer comparison checks for exact same pool = =E2=80=94 not parent/child relationships. This is intentional: a cgroup sho= uld be allowed to evict from its own children, but not from itself when it'= s trying to enforce protection. **Common ancestor logic:** Well-motivated by the comment: ```c /* * ...Recursive protection distributes cgroup protection afforded * to a parent cgroup but not used explicitly by a child cgroup between * all child cgroups... */ ``` Without this, two sibling cgroups where one is protected and the other isn'= t would both appear equally protected (due to recursive distribution from t= heir common parent), preventing the protected one from stealing from the un= protected one. **Reference management:** ```c ancestor =3D dmem_cgroup_common_ancestor(bo->resource->css, evict_walk->alloc_state->charge_pool); limit_pool =3D ancestor; ... evict_valuable =3D dmem_cgroup_state_evict_valuable(limit_pool, ...); if (ancestor) dmem_cgroup_pool_state_put(ancestor); ``` The `put` after use is correct, but relies on `dmem_cgroup_common_ancestor(= )` returning a referenced pool (see concern in patch 2 review). **Formatting nit:** The self-eviction check uses non-standard indentation: ```c if (evict_walk->alloc_state->only_evict_unprotected && bo->resource->css =3D=3D evict_walk->alloc_state->charge_pool) ``` Kernel style typically aligns continuation lines to the opening parenthesis= , or uses a single tab indent. The double-tab here is inconsistent with the= rest of the series. --- Generated by Claude Code Patch Reviewer