mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
drm/exynos: use alloc_page() to allocate pages.
shmem_read_mapping_page_gfp() first tries to allocate pages from page cache so if pages are allocated from page cache then these pages could have valid cache line. after that cpu may read garbage data from cache once gpu operation is completed with allocated pages. so with this patch, Non-contiguous memory allocation request allocates pages from highmem through alloc_page() with GFP_HIGHUSER_MOVABLE. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
This commit is contained in:
parent
f91f2f331e
commit
c62bc752f2
1 changed files with 3 additions and 11 deletions
|
@ -99,25 +99,17 @@ out:
|
||||||
struct page **exynos_gem_get_pages(struct drm_gem_object *obj,
|
struct page **exynos_gem_get_pages(struct drm_gem_object *obj,
|
||||||
gfp_t gfpmask)
|
gfp_t gfpmask)
|
||||||
{
|
{
|
||||||
struct inode *inode;
|
|
||||||
struct address_space *mapping;
|
|
||||||
struct page *p, **pages;
|
struct page *p, **pages;
|
||||||
int i, npages;
|
int i, npages;
|
||||||
|
|
||||||
/* This is the shared memory object that backs the GEM resource */
|
|
||||||
inode = obj->filp->f_path.dentry->d_inode;
|
|
||||||
mapping = inode->i_mapping;
|
|
||||||
|
|
||||||
npages = obj->size >> PAGE_SHIFT;
|
npages = obj->size >> PAGE_SHIFT;
|
||||||
|
|
||||||
pages = drm_malloc_ab(npages, sizeof(struct page *));
|
pages = drm_malloc_ab(npages, sizeof(struct page *));
|
||||||
if (pages == NULL)
|
if (pages == NULL)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
gfpmask |= mapping_gfp_mask(mapping);
|
|
||||||
|
|
||||||
for (i = 0; i < npages; i++) {
|
for (i = 0; i < npages; i++) {
|
||||||
p = shmem_read_mapping_page_gfp(mapping, i, gfpmask);
|
p = alloc_page(gfpmask);
|
||||||
if (IS_ERR(p))
|
if (IS_ERR(p))
|
||||||
goto fail;
|
goto fail;
|
||||||
pages[i] = p;
|
pages[i] = p;
|
||||||
|
@ -127,7 +119,7 @@ struct page **exynos_gem_get_pages(struct drm_gem_object *obj,
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
while (i--)
|
while (i--)
|
||||||
page_cache_release(pages[i]);
|
__free_page(pages[i]);
|
||||||
|
|
||||||
drm_free_large(pages);
|
drm_free_large(pages);
|
||||||
return ERR_PTR(PTR_ERR(p));
|
return ERR_PTR(PTR_ERR(p));
|
||||||
|
@ -189,7 +181,7 @@ static int exynos_drm_gem_get_pages(struct drm_gem_object *obj)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pages = exynos_gem_get_pages(obj, GFP_KERNEL);
|
pages = exynos_gem_get_pages(obj, GFP_HIGHUSER_MOVABLE);
|
||||||
if (IS_ERR(pages)) {
|
if (IS_ERR(pages)) {
|
||||||
DRM_ERROR("failed to get pages.\n");
|
DRM_ERROR("failed to get pages.\n");
|
||||||
return PTR_ERR(pages);
|
return PTR_ERR(pages);
|
||||||
|
|
Loading…
Reference in a new issue