Commit 708f0cac authored by Rebecca Schultz Zavin's avatar Rebecca Schultz Zavin Committed by Greg Kroah-Hartman

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.
Signed-off-by: default avatarRebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b8230243
...@@ -46,7 +46,7 @@ static struct page_info *alloc_largest_available(unsigned long size) ...@@ -46,7 +46,7 @@ static struct page_info *alloc_largest_available(unsigned long size)
if (!page) if (!page)
continue; continue;
split_page(page, orders[i]); split_page(page, orders[i]);
info = kmap(page); info = kmalloc(sizeof(struct page_info *), GFP_KERNEL);
info->page = page; info->page = page;
info->order = orders[i]; info->order = orders[i];
return info; return info;
...@@ -93,7 +93,7 @@ static int ion_system_heap_allocate(struct ion_heap *heap, ...@@ -93,7 +93,7 @@ static int ion_system_heap_allocate(struct ion_heap *heap,
} }
list_del(&info->list); list_del(&info->list);
memset(info, 0, sizeof(struct page_info)); memset(info, 0, sizeof(struct page_info));
kunmap(page); kfree(info);
} }
dma_sync_sg_for_device(NULL, table->sgl, table->nents, dma_sync_sg_for_device(NULL, table->sgl, table->nents,
...@@ -107,7 +107,7 @@ static int ion_system_heap_allocate(struct ion_heap *heap, ...@@ -107,7 +107,7 @@ static int ion_system_heap_allocate(struct ion_heap *heap,
list_for_each_entry(info, &pages, list) { list_for_each_entry(info, &pages, list) {
for (i = 0; i < (1 << info->order); i++) for (i = 0; i < (1 << info->order); i++)
__free_page(info->page + i); __free_page(info->page + i);
kunmap(info->page); kfree(info);
} }
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment