diff options
author | Rebecca Schultz Zavin | 2012-09-30 16:53:27 -0500 |
---|---|---|
committer | Arve Hjønnevåg | 2013-02-19 19:55:27 -0600 |
commit | ca0b049697efe2a6a21970ab9f639ce74622bd06 (patch) | |
tree | 1ac67bc4be28cacf883bd5896a413ac11e1c4079 | |
parent | 4c47bccab46f7f522bc545e0dce6301aabff7b4e (diff) | |
download | kernel-common-ca0b049697efe2a6a21970ab9f639ce74622bd06.tar.gz kernel-common-ca0b049697efe2a6a21970ab9f639ce74622bd06.tar.xz kernel-common-ca0b049697efe2a6a21970ab9f639ce74622bd06.zip |
gpu: ion: use vmalloc to allocate page array to map kernel
When ion_map_kernel is execute the system must allocate
an array large enough to hold a pointer to each page in
the buffer. If the buffer is very large and the system
memory has become very fragmented, there may not be
sufficient high order allocations available from kmalloc.
Use vmalloc instead.
Change-Id: I5fabf79be6cfd158f7805bfca6267a60c4708582
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
-rw-r--r-- | drivers/gpu/ion/ion_system_heap.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/ion/ion_system_heap.c b/drivers/gpu/ion/ion_system_heap.c index 7b441926a76..86e2eab5e59 100644 --- a/drivers/gpu/ion/ion_system_heap.c +++ b/drivers/gpu/ion/ion_system_heap.c | |||
@@ -174,10 +174,12 @@ void *ion_system_heap_map_kernel(struct ion_heap *heap, | |||
174 | pgprot_t pgprot; | 174 | pgprot_t pgprot; |
175 | struct sg_table *table = buffer->priv_virt; | 175 | struct sg_table *table = buffer->priv_virt; |
176 | int npages = PAGE_ALIGN(buffer->size) / PAGE_SIZE; | 176 | int npages = PAGE_ALIGN(buffer->size) / PAGE_SIZE; |
177 | struct page **pages = kzalloc(sizeof(struct page *) * npages, | 177 | struct page **pages = vmalloc(sizeof(struct page *) * npages); |
178 | GFP_KERNEL); | ||
179 | struct page **tmp = pages; | 178 | struct page **tmp = pages; |
180 | 179 | ||
180 | if (!pages) | ||
181 | return 0; | ||
182 | |||
181 | if (buffer->flags & ION_FLAG_CACHED) | 183 | if (buffer->flags & ION_FLAG_CACHED) |
182 | pgprot = PAGE_KERNEL; | 184 | pgprot = PAGE_KERNEL; |
183 | else | 185 | else |
@@ -192,7 +194,7 @@ void *ion_system_heap_map_kernel(struct ion_heap *heap, | |||
192 | } | 194 | } |
193 | } | 195 | } |
194 | vaddr = vmap(pages, npages, VM_MAP, pgprot); | 196 | vaddr = vmap(pages, npages, VM_MAP, pgprot); |
195 | kfree(pages); | 197 | vfree(pages); |
196 | 198 | ||
197 | return vaddr; | 199 | return vaddr; |
198 | } | 200 | } |