Re: [PATCH v3 1/3] drm/fdinfo: Add "evicted" memory accounting
From: Nicolas Frattaroli
Date: Fri May 08 2026 - 10:22:57 EST
On Friday, 24 April 2026 18:01:10 Central European Summer Time Tvrtko Ursulin wrote:
>
> On 23/04/2026 13:33, Nicolas Frattaroli wrote:
> > Currently, there's no way to know for certain how much GPU memory was
> > swapped out. The difference between total and resident memory would
> > include newly allocated pages, which are not resident, but also aren't
> > swapped out.
> >
> > Add a new drm_gem_object_status so drivers can signal when an object has
> > been evicted to swap, and add a new "evicted" counter to
> > drm_memory_stats.
> >
> > Due to how the supported_flags bitmask is determined, the "evicted"
> > count won't be printed to fdinfo if there's no swapped out pages.
> >
> > Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@xxxxxxxxxxxxx>
> > ---
> > Documentation/gpu/drm-usage-stats.rst | 6 ++++++
> > drivers/gpu/drm/drm_file.c | 8 ++++++++
> > include/drm/drm_file.h | 2 ++
> > include/drm/drm_gem.h | 2 ++
> > 4 files changed, 18 insertions(+)
> >
> > diff --git a/Documentation/gpu/drm-usage-stats.rst b/Documentation/gpu/drm-usage-stats.rst
> > index 24d3012ca7a6..11570976095e 100644
> > --- a/Documentation/gpu/drm-usage-stats.rst
> > +++ b/Documentation/gpu/drm-usage-stats.rst
> > @@ -200,6 +200,12 @@ One practical example of this could be the presence of unsignaled fences in a
> > GEM buffer reservation object. Therefore, the active category is a subset of the
> > resident category.
> >
> > +- drm-evicted-<region>: <uint> [KiB|MiB]
> > +
> > +The total size of buffers that have been evicted and are currently in swap
> > +space. Only present if there are buffers that are currently swapped out, and the
> > +driver implements reporting of this type of memory.
>
> Please hold off merging this for a few days, I just noticed it and would
> like to set aside some time next week to think about the semantics, how
> it applies to discrete GPUs where evicted != swapped and some other
> questions.
>
> Regards,
>
> Tvrtko
>
It's been more than a few days (2 weeks, in fact), with no follow-up.
I'm getting a little grumpy because people expressing vague concerns,
and then disappearing over the hills for weeks, is an ongoing problem
in the DRM subsystem. If you want me to reword the documentation to
decouple eviction from swapping, then I can do that, but please say
so and then review the follow-up revision so that we're actually
working towards a solution and not just rolling the dice of who saw
the e-mail thread and felt like responding this time around.
Kind regards,
Nicolas Frattaroli