Skip to content

Commit

Permalink
Merge branch 'fixes-for-linus' of git://git.linaro.org/people/mszypro…
Browse files Browse the repository at this point in the history
…wski/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
  • Loading branch information
torvalds committed Jul 17, 2012
2 parents e5254a6 + 46c8785 commit 5bb93f1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions arch/arm/mm/dma-mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size, gfp_t
while (--i)
if (pages[i])
__free_pages(pages[i], 0);
if (array_size < PAGE_SIZE)
if (array_size <= PAGE_SIZE)
kfree(pages);
else
vfree(pages);
Expand All @@ -1106,7 +1106,7 @@ static int __iommu_free_buffer(struct device *dev, struct page **pages, size_t s
for (i = 0; i < count; i++)
if (pages[i])
__free_pages(pages[i], 0);
if (array_size < PAGE_SIZE)
if (array_size <= PAGE_SIZE)
kfree(pages);
else
vfree(pages);
Expand Down
2 changes: 1 addition & 1 deletion include/asm-generic/dma-contiguous.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ static inline void dev_set_cma_area(struct device *dev, struct cma *cma)
{
if (dev)
dev->cma_area = cma;
if (!dev || !dma_contiguous_default_area)
if (!dev && !dma_contiguous_default_area)
dma_contiguous_default_area = cma;
}

Expand Down
7 changes: 6 additions & 1 deletion mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5635,7 +5635,12 @@ static struct page *
__alloc_contig_migrate_alloc(struct page *page, unsigned long private,
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. */
Expand Down

0 comments on commit 5bb93f1

Please sign in to comment.