Commit 5bb93f1a authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'fixes-for-linus' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping

Pull CMA and DMA-mapping fixes from Marek Szyprowski:
 "Another set of minor fixups for recently merged Contiguous Memory
  Allocator and ARM DMA-mapping changes.  Those patches fix mysterious
  crashes on systems with CMA and Himem enabled as well as some corner
  cases caused by typical off-by-one bug."

* 'fixes-for-linus' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping:
  ARM: dma-mapping: modify condition check while freeing pages
  mm: cma: fix condition check when setting global cma area
  mm: cma: don't replace lowmem pages with highmem
parents e5254a62 46c87852
...@@ -1091,7 +1091,7 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size, gfp_t ...@@ -1091,7 +1091,7 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size, gfp_t
while (--i) while (--i)
if (pages[i]) if (pages[i])
__free_pages(pages[i], 0); __free_pages(pages[i], 0);
if (array_size < PAGE_SIZE) if (array_size <= PAGE_SIZE)
kfree(pages); kfree(pages);
else else
vfree(pages); vfree(pages);
...@@ -1106,7 +1106,7 @@ static int __iommu_free_buffer(struct device *dev, struct page **pages, size_t s ...@@ -1106,7 +1106,7 @@ static int __iommu_free_buffer(struct device *dev, struct page **pages, size_t s
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
if (pages[i]) if (pages[i])
__free_pages(pages[i], 0); __free_pages(pages[i], 0);
if (array_size < PAGE_SIZE) if (array_size <= PAGE_SIZE)
kfree(pages); kfree(pages);
else else
vfree(pages); vfree(pages);
......
...@@ -18,7 +18,7 @@ static inline void dev_set_cma_area(struct device *dev, struct cma *cma) ...@@ -18,7 +18,7 @@ static inline void dev_set_cma_area(struct device *dev, struct cma *cma)
{ {
if (dev) if (dev)
dev->cma_area = cma; dev->cma_area = cma;
if (!dev || !dma_contiguous_default_area) if (!dev && !dma_contiguous_default_area)
dma_contiguous_default_area = cma; dma_contiguous_default_area = cma;
} }
......
...@@ -5635,7 +5635,12 @@ static struct page * ...@@ -5635,7 +5635,12 @@ static struct page *
__alloc_contig_migrate_alloc(struct page *page, unsigned long private, __alloc_contig_migrate_alloc(struct page *page, unsigned long private,
int **resultp) int **resultp)
{ {
return alloc_page(GFP_HIGHUSER_MOVABLE); gfp_t gfp_mask = GFP_USER | __GFP_MOVABLE;
if (PageHighMem(page))
gfp_mask |= __GFP_HIGHMEM;
return alloc_page(gfp_mask);
} }
/* [start, end) must belong to a single zone. */ /* [start, end) must belong to a single zone. */
......
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