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/fdinfo: Add "evicted" memory accounting Date: Thu, 23 Apr 2026 08:36:40 +1000 Message-ID: In-Reply-To: <20260421-panthor-bo-reclaim-observability-v2-1-c9135eedfb6f@collabora.com> References: <20260421-panthor-bo-reclaim-observability-v2-0-c9135eedfb6f@collabora.com> <20260421-panthor-bo-reclaim-observability-v2-1-c9135eedfb6f@collabora.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review This patch adds `DRM_GEM_OBJECT_EVICTED =3D BIT(3)` to the status enum, an = `evicted` field to `drm_memory_stats`, and wires them into the fdinfo print= ing/accumulation paths. **Issue: Missing drm-usage-stats.rst documentation.** The new `drm-evicted-` key needs an entry in `Documentation/gpu/drm= -usage-stats.rst` alongside the existing documented keys. This file explici= tly says driver-specific stats "should be documented above and where possib= le, aligned with other drivers." Since this is being added to the core DRM = framework for any driver to use, it's especially important to document the = semantics =E2=80=94 for example, that evicted is a subset of non-resident m= emory. **Minor observation on semantics in `drm_show_memory_stats()`:** The existing code clears `DRM_GEM_OBJECT_PURGEABLE` when the object is not = resident: ```c if (s & DRM_GEM_OBJECT_RESIDENT) { status.resident +=3D add_size; } else { s &=3D ~DRM_GEM_OBJECT_PURGEABLE; } ``` The new `DRM_GEM_OBJECT_EVICTED` is accumulated without any filtering. This= is correct =E2=80=94 evicted objects are by definition not resident, so th= e semantics are different from purgeable (which is defined as resident + id= le + marked). However, the core code doesn't enforce mutual exclusivity bet= ween RESIDENT and EVICTED. If a driver were to erroneously return both, bot= h counters would be incremented. This is arguably fine (it's the driver's j= ob to set bits correctly), but a brief comment on the enum doc noting that = EVICTED implies non-resident would be helpful. **Code is correct as written.** The additions to `drm_memory_stats_is_zero(= )`, `drm_print_memory_stats()`, and `drm_show_memory_stats()` all follow th= e established pattern. --- Generated by Claude Code Patch Reviewer