Skip to contentSkip to conversation

drm/radeon: fix userptr BO unpin bug v2

PATCH Applied Christian König 2 participants 2 messages May 5, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon: fix userptr BO unpin bug v2

From: "monk.liu" <[email protected]>

Fixing a memory leak with userptrs.

v2: clean up the loop, use an iterator instead

---
 drivers/gpu/drm/radeon/radeon_ttm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_ttm.c +3 -4
index b292aca..921dd0f 100644
@@ -591,7 +591,7 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
 {
 	struct radeon_device *rdev = radeon_get_rdev(ttm->bdev);
 	struct radeon_ttm_tt *gtt = (void *)ttm;
-	struct scatterlist *sg;
+	struct sg_page_iter sg_iter;
 	int i;
 
 	int write = !(gtt->userflags & RADEON_GEM_USERPTR_READONLY);
@@ -605,9 +605,8 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
 	/* free the sg table and pages again */
 	dma_unmap_sg(rdev->dev, ttm->sg->sgl, ttm->sg->nents, direction);
 
-	for_each_sg(ttm->sg->sgl, sg, ttm->sg->nents, i) {
-		struct page *page = sg_page(sg);
-
+	for_each_sg_page(ttm->sg->sgl, &sg_iter, ttm->sg->nents, 0) {
+		struct page *page = sg_page_iter_page(&sg_iter);
 		if (!(gtt->userflags & RADEON_GEM_USERPTR_READONLY))
 			set_page_dirty(page);
 
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Applied
#1 lore raw
Quoted 9 lines · Christian König

From: "monk.liu" <[email protected]>

Fixing a memory leak with userptrs.

v2: clean up the loop, use an iterator instead

Applied to my -fixes tree.

Alex

Quoted 30 lines
---
 drivers/gpu/drm/radeon/radeon_ttm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_ttm.c +3 -5
index b292aca..921dd0f 100644
@@ -591,7 +591,7 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
 {
        struct radeon_device *rdev = radeon_get_rdev(ttm->bdev);
        struct radeon_ttm_tt *gtt = (void *)ttm;
-       struct scatterlist *sg;
+       struct sg_page_iter sg_iter;
        int i;
 
        int write = !(gtt->userflags & RADEON_GEM_USERPTR_READONLY);
@@ -605,9 +605,8 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
        /* free the sg table and pages again */
        dma_unmap_sg(rdev->dev, ttm->sg->sgl, ttm->sg->nents, direction);
 
-       for_each_sg(ttm->sg->sgl, sg, ttm->sg->nents, i) {
-               struct page *page = sg_page(sg);
-
+       for_each_sg_page(ttm->sg->sgl, &sg_iter, ttm->sg->nents, 0) {
+               struct page *page = sg_page_iter_page(&sg_iter);
                if (!(gtt->userflags & RADEON_GEM_USERPTR_READONLY))
                        set_page_dirty(page);
 
--
Quoted 2 lines

1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel