diff mbox series

[1/2] drm: update drm_show_memory_stats() for dma-bufs

Message ID 20231207180225.439482-2-alexander.deucher@amd.com (mailing list archive)
State New, archived
Headers show
Series fdinfo shared stats | expand

Commit Message

Alex Deucher Dec. 7, 2023, 6:02 p.m. UTC
Show buffers as shared if they are shared via dma-buf as well
(e.g., shared with v4l or some other subsystem).

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Rob Clark <robdclark@gmail.com>
---
 drivers/gpu/drm/drm_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Felix Kuehling Dec. 13, 2023, 9:28 p.m. UTC | #1
On 2023-12-07 13:02, Alex Deucher wrote:
> Show buffers as shared if they are shared via dma-buf as well
> (e.g., shared with v4l or some other subsystem).

You can add KFD to that list. With the in-progress CUDA11 VM changes and 
improved interop between KFD and render nodes, sharing DMABufs between 
KFD and render nodes will become much more common.

Regards,
   Felix


>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Cc: Rob Clark <robdclark@gmail.com>
> ---
>   drivers/gpu/drm/drm_file.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
> index 5ddaffd32586..5d5f93b9c263 100644
> --- a/drivers/gpu/drm/drm_file.c
> +++ b/drivers/gpu/drm/drm_file.c
> @@ -973,7 +973,7 @@ void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file)
>   					DRM_GEM_OBJECT_PURGEABLE;
>   		}
>   
> -		if (obj->handle_count > 1) {
> +		if ((obj->handle_count > 1) || obj->dma_buf) {
>   			status.shared += obj->size;
>   		} else {
>   			status.private += obj->size;
Rob Clark Jan. 8, 2024, 5:29 p.m. UTC | #2
On Thu, Dec 7, 2023 at 10:02 AM Alex Deucher <alexander.deucher@amd.com> wrote:
>
> Show buffers as shared if they are shared via dma-buf as well
> (e.g., shared with v4l or some other subsystem).
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Cc: Rob Clark <robdclark@gmail.com>

Reviewed-by: Rob Clark <robdclark@gmail.com>

> ---
>  drivers/gpu/drm/drm_file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
> index 5ddaffd32586..5d5f93b9c263 100644
> --- a/drivers/gpu/drm/drm_file.c
> +++ b/drivers/gpu/drm/drm_file.c
> @@ -973,7 +973,7 @@ void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file)
>                                         DRM_GEM_OBJECT_PURGEABLE;
>                 }
>
> -               if (obj->handle_count > 1) {
> +               if ((obj->handle_count > 1) || obj->dma_buf) {
>                         status.shared += obj->size;
>                 } else {
>                         status.private += obj->size;
> --
> 2.42.0
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index 5ddaffd32586..5d5f93b9c263 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -973,7 +973,7 @@  void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file)
 					DRM_GEM_OBJECT_PURGEABLE;
 		}
 
-		if (obj->handle_count > 1) {
+		if ((obj->handle_count > 1) || obj->dma_buf) {
 			status.shared += obj->size;
 		} else {
 			status.private += obj->size;