[PATCH] drm/amdgpu: free userptrs even if GTT isn't bound

Alex Deucher alexdeucher at gmail.com
Thu Sep 22 14:27:19 UTC 2016


On Thu, Sep 22, 2016 at 8:53 AM, Christian König
<deathsimple at vodafone.de> wrote:
> From: Christian König <christian.koenig at amd.com>
>
> This fixes a memory leak since binding GTT only on demand.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 219f056..ce9da20 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -758,6 +758,9 @@ static int amdgpu_ttm_backend_unbind(struct ttm_tt *ttm)
>  {
>         struct amdgpu_ttm_tt *gtt = (void *)ttm;
>
> +       if (gtt->userptr)
> +               amdgpu_ttm_tt_unpin_userptr(ttm);
> +
>         if (!amdgpu_ttm_is_bound(ttm))
>                 return 0;
>
> @@ -765,9 +768,6 @@ static int amdgpu_ttm_backend_unbind(struct ttm_tt *ttm)
>         if (gtt->adev->gart.ready)
>                 amdgpu_gart_unbind(gtt->adev, gtt->offset, ttm->num_pages);
>
> -       if (gtt->userptr)
> -               amdgpu_ttm_tt_unpin_userptr(ttm);
> -
>         spin_lock(&gtt->adev->gtt_list_lock);
>         list_del_init(&gtt->list);
>         spin_unlock(&gtt->adev->gtt_list_lock);
> --
> 2.5.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list