diff options
author | Adrián Larumbe <adrian.larumbe@collabora.com> | 2023-09-29 19:14:30 +0100 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@collabora.com> | 2023-10-04 13:04:15 +0200 |
commit | 553c84892bac704e1a7999b7db7e67640a31a4fa (patch) | |
tree | 8cfe8618b46515238f6bcbd364c4f75d407be6aa /include | |
parent | 9ccdac7aa822f0468893e161c1a311674667da1b (diff) |
drm/drm_file: Add DRM obj's RSS reporting function for fdinfo
Some BO's might be mapped onto physical memory chunkwise and on demand,
like Panfrost's tiler heap. In this case, even though the
drm_gem_shmem_object page array might already be allocated, only a very
small fraction of the BO is currently backed by system memory, but
drm_show_memory_stats will then proceed to add its entire virtual size to
the file's total resident size regardless.
This led to very unrealistic RSS sizes being reckoned for Panfrost, where
said tiler heap buffer is initially allocated with a virtual size of 128
MiB, but only a small part of it will eventually be backed by system memory
after successive GPU page faults.
Provide a new DRM object generic function that would allow drivers to
return a more accurate RSS and purgeable sizes for their BOs.
Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230929181616.2769345-5-adrian.larumbe@collabora.com
Diffstat (limited to 'include')
-rw-r--r-- | include/drm/drm_gem.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index bc9f6aa2f3fe..16364487fde9 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h @@ -209,6 +209,15 @@ struct drm_gem_object_funcs { enum drm_gem_object_status (*status)(struct drm_gem_object *obj); /** + * @rss: + * + * Return resident size of the object in physical memory. + * + * Called by drm_show_memory_stats(). + */ + size_t (*rss)(struct drm_gem_object *obj); + + /** * @vm_ops: * * Virtual memory operations used with mmap. |