drm/i915: Do not leak pages when freeing userptr objects
Subsystems (2)
PATCH 1/1 drm/i915: Do not leak pages when freeing userptr objects
From: Tvrtko Ursulin <[email protected]>
sg_alloc_table_from_pages() can build us a table with coalesced ranges which means we need to iterate over pages and not sg table entries when releasing page references.
--- drivers/gpu/drm/i915/i915_gem_userptr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_userptr.c +3 -3
@@ -682,15 +682,15 @@ static void i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj) {struct scatterlist *sg; -int i; +struct sg_page_iter sg_iter;BUG_ON (obj->userptr.work !=NULL );if (obj->madv !=I915_MADV_WILLNEED ) obj->dirty =0 ; -for_each_sg (obj->pages->sgl, sg, obj->pages->nents, i) { -struct page *page =sg_page (sg); +for_each_sg_page (obj->pages->sgl, &sg_iter, obj->pages->nents,0 ) { +struct page *page =sg_page_iter_page (&sg_iter);if (obj->dirty)set_page_dirty (page);
Signature · 1 line
2.1.0
Quoted 9 lines
-----Original Message-----
From: Tvrtko Ursulin [mailto:[email protected]]
Sent: Friday, September 26, 2014 3:05 PM
To: [email protected]
Cc: Ursulin, Tvrtko; Chris Wilson; Barbalho, Rafael
Subject: [PATCH] drm/i915: Do not leak pages when freeing userptr objectsFrom: Tvrtko Ursulin <[email protected]>
Quoted 8 lines
sg_alloc_table_from_pages()can build us a table with coalesced ranges which
means we need to iterate over pages and not sg table entries when releasing page references.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc "Barbalho, Rafael" <[email protected]>
Quoted 31 lines
--- drivers/gpu/drm/i915/i915_gem_userptr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_gem_userptr.c +3
-3@@ -682,15 +682,15 @@ static void i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj) {struct scatterlist *sg; -int i; +struct sg_page_iter sg_iter;BUG_ON (obj->userptr.work !=NULL );if (obj->madv !=I915_MADV_WILLNEED ) obj->dirty =0 ; -for_each_sg (obj->pages->sgl, sg, obj->pages->nents, i) { -struct page *page =sg_page (sg); +for_each_sg_page (obj->pages->sgl, &sg_iter, obj->pages->nents,0 ) { +struct page *page =sg_page_iter_page (&sg_iter);if (obj->dirty)
set_page_dirty(page);
--
2.1.0
Quoted 9 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
sg_alloc_table_from_pages()can build us a table with coalesced ranges which means we need to iterate over pages and not sg table entries when releasing page references.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc "Barbalho, Rafael" <[email protected]>
Oh that's fun. I blame Imre for the recent invention of for_each_sg_page()!
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 7 lines · Chris Wilson
Quoted 6 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
sg_alloc_table_from_pages()can build us a table with coalesced ranges which means we need to iterate over pages and not sg table entries when releasing page references.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc "Barbalho, Rafael" <[email protected]>Oh that's fun. I blame Imre for the recent invention of
for_each_sg_page()!Reviewed-by Chris Wilson <[email protected]>
Pushed to drm-intel-fixes, with the unused struct scatterlist *sg variable removed. Thanks for the patch, review, and testing.
BR,
Jani.
Quoted 8 lines
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Quoted 7 lines · Chris Wilson
Quoted 6 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
sg_alloc_table_from_pages()can build us a table with coalesced ranges which means we need to iterate over pages and not sg table entries when releasing page references.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc "Barbalho, Rafael" <[email protected]>Oh that's fun. I blame Imre for the recent invention of
for_each_sg_page()!Reviewed-by Chris Wilson <[email protected]>
Again merged to dinf for vetting time, thanks for patch&review. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch