Re: [PATCH] drm/amdgpu/ttm: Fix memory leak userptr pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 17.03.21 um 17:08 schrieb Daniel Gomez:
If userptr pages have been pinned but not bounded,
they remain uncleared.

Signed-off-by: Daniel Gomez <daniel@xxxxxxxx>

Good catch, not sure if that can ever happen in practice but better save than sorry.

Reviewed-by: Christian König <christian.koenig@xxxxxxx>

---
  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 9fd2157b133a..50c2b4827c13 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1162,13 +1162,13 @@ static void amdgpu_ttm_backend_unbind(struct ttm_bo_device *bdev,
  	struct amdgpu_ttm_tt *gtt = (void *)ttm;
  	int r;
- if (!gtt->bound)
-		return;
-
  	/* if the pages have userptr pinning then clear that first */
  	if (gtt->userptr)
  		amdgpu_ttm_tt_unpin_userptr(bdev, ttm);
+ if (!gtt->bound)
+		return;
+
  	if (gtt->offset == AMDGPU_BO_INVALID_OFFSET)
  		return;

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux