[PATCH] drm/amdgpu: Fix VRAM memory accounting

Felix Kuehling felix.kuehling at amd.com
Tue Apr 23 19:33:41 UTC 2024


On 2024-04-23 14:56, Mukul Joshi wrote:
> Subtract the VRAM pinned memory when checking for available memory
> in amdgpu_amdkfd_reserve_mem_limit function since that memory is not
> available for use.
>
> Signed-off-by: Mukul Joshi <mukul.joshi at amd.com>

Reviewed-by: Felix Kuehling <felix.kuehling at amd.com>


> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index 101a2836480d..f672205243e0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -220,7 +220,7 @@ int amdgpu_amdkfd_reserve_mem_limit(struct amdgpu_device *adev,
>   	    (kfd_mem_limit.ttm_mem_used + ttm_mem_needed >
>   	     kfd_mem_limit.max_ttm_mem_limit) ||
>   	    (adev && xcp_id >= 0 && adev->kfd.vram_used[xcp_id] + vram_needed >
> -	     vram_size - reserved_for_pt)) {
> +	     vram_size - reserved_for_pt - atomic64_read(&adev->vram_pin_size))) {
>   		ret = -ENOMEM;
>   		goto release;
>   	}


More information about the amd-gfx mailing list