aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorInki Dae <inki.dae@samsung.com>2012-07-09 01:35:38 -0400
committerInki Dae <inki.dae@samsung.com>2012-07-26 22:13:57 -0400
commitd73c1c995b916a08bfc2d3707afbd3fbf9747300 (patch)
tree20ae32dddaf488b78943d187718e2070072511a3 /drivers/gpu
parent3c52b8804fe7039b4d1a4c90a0633aab9f8c59dd (diff)
drm/exynos: use __free_page() to deallocate memory
this patch uses __free_page() to deallocate the pages allocated by alloc_page() and the pages doesn't need set_parge_dirty() and mark_page_accessed() because they aren't from page cache so removes them. this patch has a pair with previous patch below, http://www.spinics.net/lists/dri-devel/msg24382.html Changelog v2: remove unnecessary arguments. Changelog v3: fix npages type. - npages can have negative value. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_gem.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index a9bf526c1704..2da6cdb1fa37 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -126,23 +126,14 @@ fail:
126} 126}
127 127
128static void exynos_gem_put_pages(struct drm_gem_object *obj, 128static void exynos_gem_put_pages(struct drm_gem_object *obj,
129 struct page **pages, 129 struct page **pages)
130 bool dirty, bool accessed)
131{ 130{
132 int i, npages; 131 int npages;
133 132
134 npages = obj->size >> PAGE_SHIFT; 133 npages = obj->size >> PAGE_SHIFT;
135 134
136 for (i = 0; i < npages; i++) { 135 while (--npages >= 0)
137 if (dirty) 136 __free_page(pages[npages]);
138 set_page_dirty(pages[i]);
139
140 if (accessed)
141 mark_page_accessed(pages[i]);
142
143 /* Undo the reference we took when populating the table */
144 page_cache_release(pages[i]);
145 }
146 137
147 drm_free_large(pages); 138 drm_free_large(pages);
148} 139}
@@ -222,7 +213,7 @@ err1:
222 kfree(buf->sgt); 213 kfree(buf->sgt);
223 buf->sgt = NULL; 214 buf->sgt = NULL;
224err: 215err:
225 exynos_gem_put_pages(obj, pages, true, false); 216 exynos_gem_put_pages(obj, pages);
226 return ret; 217 return ret;
227 218
228} 219}
@@ -240,7 +231,7 @@ static void exynos_drm_gem_put_pages(struct drm_gem_object *obj)
240 kfree(buf->sgt); 231 kfree(buf->sgt);
241 buf->sgt = NULL; 232 buf->sgt = NULL;
242 233
243 exynos_gem_put_pages(obj, buf->pages, true, false); 234 exynos_gem_put_pages(obj, buf->pages);
244 buf->pages = NULL; 235 buf->pages = NULL;
245 236
246 /* add some codes for UNCACHED type here. TODO */ 237 /* add some codes for UNCACHED type here. TODO */