diff options
| author | Liam Mark <lmark@codeaurora.org> | 2015-08-11 08:41:59 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:03:42 -0700 |
| commit | ed71b13963ac2e9c4513832bb9076d58bc882388 (patch) | |
| tree | 31392af351538e94177c62914c65bc02ca05439a /drivers/base | |
| parent | dd0ab21370a678e41f7f7dd711ff89745ca26db8 (diff) | |
common: dma-mapping: make dma_common_contiguous_remap more robust
Large allocations can result in the dma_common_contiguous_remap
call not being able to succeed because it can't find enough
contiguous memory to setup the mapping.
Make dma_common_contiguous_remap more robust by using vmalloc
as a fallback.
Change-Id: I12ca710b4c24f4ef24bc33a0d1d4922196fb7492
Signed-off-by: Liam Mark <lmark@codeaurora.org>
Diffstat (limited to 'drivers/base')
| -rw-r--r-- | drivers/base/dma-mapping.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c index 422f81ee692f..513065dc1499 100644 --- a/drivers/base/dma-mapping.c +++ b/drivers/base/dma-mapping.c @@ -309,7 +309,12 @@ void *dma_common_contiguous_remap(struct page *page, size_t size, void *ptr; unsigned long pfn; - pages = kmalloc(sizeof(struct page *) << get_order(size), GFP_KERNEL); + pages = kmalloc(sizeof(struct page *) << get_order(size), + GFP_KERNEL | __GFP_NOWARN); + + if (!pages) + pages = vmalloc(sizeof(struct page *) << get_order(size)); + if (!pages) return NULL; @@ -318,7 +323,7 @@ void *dma_common_contiguous_remap(struct page *page, size_t size, ptr = dma_common_pages_remap(pages, size, vm_flags, prot, caller); - kfree(pages); + kvfree(pages); return ptr; } |
