[PATCH v5 2/4] drm/amdgpu: make drm-memory-* report resident memory
Tvrtko Ursulin
tvrtko.ursulin at igalia.com
Fri Oct 18 15:39:49 UTC 2024
On 18/10/2024 14:33, Yunxiang Li wrote:
> The old behavior reports the resident memory usage for this key and the
> documentation say so as well. However this was accidentally changed to
> include buffers that was evicted.
>
> Fixes: a2529f67e2ed ("drm/amdgpu: Use drm_print_memory_stats helper from fdinfo")
> Signed-off-by: Yunxiang Li <Yunxiang.Li at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 7 ++++---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 1 -
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 -
> 3 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> index 00a4ab082459f..8281dd45faaa0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> @@ -33,6 +33,7 @@
> #include <drm/amdgpu_drm.h>
> #include <drm/drm_debugfs.h>
> #include <drm/drm_drv.h>
> +#include <drm/drm_file.h>
>
> #include "amdgpu.h"
> #include "amdgpu_vm.h"
> @@ -95,11 +96,11 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
>
> /* Legacy amdgpu keys, alias to drm-resident-memory-: */
> drm_printf(p, "drm-memory-vram:\t%llu KiB\n",
> - stats[TTM_PL_VRAM].total/1024UL);
> + stats[TTM_PL_VRAM].drm.resident/1024UL);
> drm_printf(p, "drm-memory-gtt: \t%llu KiB\n",
> - stats[TTM_PL_TT].total/1024UL);
> + stats[TTM_PL_TT].drm.resident/1024UL);
> drm_printf(p, "drm-memory-cpu: \t%llu KiB\n",
> - stats[TTM_PL_SYSTEM].total/1024UL);
> + stats[TTM_PL_SYSTEM].drm.resident/1024UL);
>
> /* Amdgpu specific memory accounting keys: */
> drm_printf(p, "amd-memory-visible-vram:\t%llu KiB\n",
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 045222b6bd049..2a53e72f3964f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -1223,7 +1223,6 @@ void amdgpu_bo_get_memory(struct amdgpu_bo *bo,
>
> /* DRM stats common fields: */
>
> - stats[type].total += size;
> if (drm_gem_object_is_shared_for_memory_stats(obj))
> stats[type].drm.shared += size;
> else
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> index 7260349917ef0..a5653f474f85c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> @@ -142,7 +142,6 @@ struct amdgpu_bo_vm {
> struct amdgpu_mem_stats {
> struct drm_memory_stats drm;
>
> - uint64_t total;
> uint64_t visible;
> uint64_t evicted;
> uint64_t evicted_visible;
LGTM, thanks for fixing it!
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
Regards,
Tvrtko
More information about the amd-gfx
mailing list