[Intel-gfx] [RFC v5 00/17] DRM cgroup controller with scheduling control and memory stats
T.J. Mercier
tjmercier at google.com
Wed Jul 19 20:31:54 UTC 2023
On Wed, Jul 12, 2023 at 4:47 AM Tvrtko Ursulin
<tvrtko.ursulin at linux.intel.com> wrote:
>
> drm.memory.stat
> A nested file containing cumulative memory statistics for the whole
> sub-hierarchy, broken down into separate GPUs and separate memory
> regions supported by the latter.
>
> For example::
>
> $ cat drm.memory.stat
> card0 region=system total=12898304 shared=0 active=0 resident=12111872 purgeable=167936
> card0 region=stolen-system total=0 shared=0 active=0 resident=0 purgeable=0
>
> Card designation corresponds to the DRM device names and multiple line
> entries can be present per card.
>
> Memory region names should be expected to be driver specific with the
> exception of 'system' which is standardised and applicable for GPUs
> which can operate on system memory buffers.
>
> Sub-keys 'resident' and 'purgeable' are optional.
>
> Per category region usage is reported in bytes.
>
> * Feedback from people interested in drm.active_us and drm.memory.stat is
> required to understand the use cases and their usefulness (of the fields).
>
> Memory stats are something which was easy to add to my series, since I was
> already working on the fdinfo memory stats patches, but the question is how
> useful it is.
>
Hi Tvrtko,
I think this style of driver-defined categories for reporting of
memory could potentially allow us to eliminate the GPU memory tracking
tracepoint used on Android (gpu_mem_total). This would involve reading
drm.memory.stat at the root cgroup (I see it's currently disabled on
the root), which means traversing the whole cgroup tree under the
cgroup lock to generate the values on-demand. This would be done
rarely, but I still wonder what the cost of that would turn out to be.
The drm_memory_stats categories in the output don't seem like a big
value-add for this use-case, but no real objection to them being
there. I know it's called the DRM cgroup controller, but it'd be nice
if there were a way to make the mem tracking part work for any driver
that wishes to participate as many of our devices don't use a DRM
driver. But making that work doesn't look like it would fit very
cleanly into this controller, so I'll just shut up now.
Thanks!
-T.J.
More information about the Intel-gfx
mailing list