gpu: ion: Switch to using kmalloc rather than kmap during allocation
Previously, metadata was stored in the allocated pages themselves
during allocation. However the system can only have a limited
number of kmapped pages. A very large allocation might exceed
this limit.
Change-Id: Ibe972096e83924bf5e621d8282c4cd133ca75b0a
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Git-commit: b144bf48c486f6fb7a7ec5ed96af62bef586c89f
Git-repo: https://android.googlesource.com/kernel/common
[lauraa@codeaurora.org: Needed to fixup context due to parent
change being merged first in cherry-picking]
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
diff --git a/drivers/gpu/ion/ion_system_heap.c b/drivers/gpu/ion/ion_system_heap.c
index af7f04b..f3f627d 100644
--- a/drivers/gpu/ion/ion_system_heap.c
+++ b/drivers/gpu/ion/ion_system_heap.c
@@ -57,7 +57,7 @@
continue;
if (split_pages)
split_page(page, orders[i]);
- info = kmap(page);
+ info = kmalloc(sizeof(struct page_info *), GFP_KERNEL);
info->page = page;
info->order = orders[i];
return info;
@@ -118,7 +118,7 @@
sg = sg_next(sg);
}
list_del(&info->list);
- kunmap(page);
+ kfree(info);
}
dma_sync_sg_for_device(NULL, table->sgl, table->nents,
@@ -137,7 +137,7 @@
else
__free_pages(info->page, info->order);
- kunmap(info->page);
+ kfree(info);
}
return -ENOMEM;
}