Skip to content

Commit

Permalink
drm/exynos: use __free_page() to deallocate memory
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Inki Dae committed Jul 27, 2012
1 parent 3c52b88 commit d73c1c9
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions drivers/gpu/drm/exynos/exynos_drm_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,23 +126,14 @@ struct page **exynos_gem_get_pages(struct drm_gem_object *obj,
}

static void exynos_gem_put_pages(struct drm_gem_object *obj,
struct page **pages,
bool dirty, bool accessed)
struct page **pages)
{
int i, npages;
int npages;

npages = obj->size >> PAGE_SHIFT;

for (i = 0; i < npages; i++) {
if (dirty)
set_page_dirty(pages[i]);

if (accessed)
mark_page_accessed(pages[i]);

/* Undo the reference we took when populating the table */
page_cache_release(pages[i]);
}
while (--npages >= 0)
__free_page(pages[npages]);

drm_free_large(pages);
}
Expand Down Expand Up @@ -222,7 +213,7 @@ static int exynos_drm_gem_get_pages(struct drm_gem_object *obj)
kfree(buf->sgt);
buf->sgt = NULL;
err:
exynos_gem_put_pages(obj, pages, true, false);
exynos_gem_put_pages(obj, pages);
return ret;

}
Expand All @@ -240,7 +231,7 @@ static void exynos_drm_gem_put_pages(struct drm_gem_object *obj)
kfree(buf->sgt);
buf->sgt = NULL;

exynos_gem_put_pages(obj, buf->pages, true, false);
exynos_gem_put_pages(obj, buf->pages);
buf->pages = NULL;

/* add some codes for UNCACHED type here. TODO */
Expand Down

0 comments on commit d73c1c9

Please sign in to comment.