linux-next: manual merge of the akpm-current tree with the dma-mapping tree

From: Stephen Rothwell
Date: Tue Oct 28 2014 - 00:24:57 EST


Hi Andrew,

Today's linux-next merge of the akpm-current tree got a conflict in
mm/cma.c between commit 16195ddd4ebc ("mm: cma: Ensure that
reservations never cross the low/high mem boundary") from the
dma-mapping tree and commit 2a70e5a78672 ("mm/cma: ake kmemleak ignore
CMA regions") from the akpm-current tree.

I fixed it up (I think - see below) and can carry the fix as necessary
(no action is required).

--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx

diff --cc mm/cma.c
index fde706e1284f,471fcfef043b..000000000000
--- a/mm/cma.c
+++ b/mm/cma.c
@@@ -278,30 -274,20 +278,35 @@@ int __init cma_declare_contiguous(phys_
goto err;
}
} else {
- phys_addr_t addr = memblock_alloc_range(size, alignment, base,
- limit);
+ phys_addr_t addr = 0;
+
+ /*
+ * All pages in the reserved area must come from the same zone.
+ * If the requested region crosses the low/high memory boundary,
+ * try allocating from high memory first and fall back to low
+ * memory in case of failure.
+ */
+ if (base < highmem_start && limit > highmem_start) {
+ addr = memblock_alloc_range(size, alignment,
+ highmem_start, limit);
+ limit = highmem_start;
+ }
+
if (!addr) {
- ret = -ENOMEM;
- goto err;
- } else {
- /*
- * kmemleak scans/reads tracked objects for pointers to
- * other objects but this address isn't mapped and
- * accessible
- */
- kmemleak_ignore(phys_to_virt(addr));
- base = addr;
+ addr = memblock_alloc_range(size, alignment, base,
+ limit);
+ if (!addr) {
+ ret = -ENOMEM;
+ goto err;
+ }
}
-
++ /*
++ * kmemleak scans/reads tracked objects for pointers to
++ * other objects but this address isn't mapped and
++ * accessible
++ */
++ kmemleak_ignore(phys_to_virt(addr));
+ base = addr;
}

ret = cma_init_reserved_mem(base, size, order_per_bit, res_cma);

Attachment: pgpq4WsM7oYUb.pgp
Description: OpenPGP digital signature