AW: [PATCH] drm/radeon/ttm: Fix memory leak userptr pages

Koenig, Christian Christian.Koenig at amd.com
Thu Mar 18 09:00:30 UTC 2021


Reviewed-by: Christian König <christian.koenig at amd.com>
________________________________
Von: Daniel Gomez <daniel at qtec.com>
Gesendet: Donnerstag, 18. März 2021 09:32
Cc: dagmcr at gmail.com <dagmcr at gmail.com>; Daniel Gomez <daniel at qtec.com>; Deucher, Alexander <Alexander.Deucher at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>; David Airlie <airlied at linux.ie>; Daniel Vetter <daniel at ffwll.ch>; amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>; dri-devel at lists.freedesktop.org <dri-devel at lists.freedesktop.org>; linux-kernel at vger.kernel.org <linux-kernel at vger.kernel.org>
Betreff: [PATCH] drm/radeon/ttm: Fix memory leak userptr pages

If userptr pages have been pinned but not bounded,
they remain uncleared.

Signed-off-by: Daniel Gomez <daniel at qtec.com>
---
 drivers/gpu/drm/radeon/radeon_ttm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index e8c66d10478f..bbcc6264d48f 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -485,13 +485,14 @@ static void radeon_ttm_backend_unbind(struct ttm_bo_device *bdev, struct ttm_tt
         struct radeon_ttm_tt *gtt = (void *)ttm;
         struct radeon_device *rdev = radeon_get_rdev(bdev);

+       if (gtt->userptr)
+               radeon_ttm_tt_unpin_userptr(bdev, ttm);
+
         if (!gtt->bound)
                 return;

         radeon_gart_unbind(rdev, gtt->offset, ttm->num_pages);

-       if (gtt->userptr)
-               radeon_ttm_tt_unpin_userptr(bdev, ttm);
         gtt->bound = false;
 }

--
2.30.2

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20210318/af94287c/attachment-0001.htm>


More information about the dri-devel mailing list