extern void zone_pcp_disable(struct zone *zone);
 extern void zone_pcp_enable(struct zone *zone);
 
+extern void *memmap_alloc(phys_addr_t size, phys_addr_t align,
+                         phys_addr_t min_addr,
+                         int nid, bool exact_nid);
+
 #if defined CONFIG_COMPACTION || defined CONFIG_CMA
 
 /*
 
                init_unavailable_range(hole_pfn, end_pfn, zone_id, nid);
 }
 
+void __init *memmap_alloc(phys_addr_t size, phys_addr_t align,
+                         phys_addr_t min_addr, int nid, bool exact_nid)
+{
+       void *ptr;
+
+       if (exact_nid)
+               ptr = memblock_alloc_exact_nid_raw(size, align, min_addr,
+                                                  MEMBLOCK_ALLOC_ACCESSIBLE,
+                                                  nid);
+       else
+               ptr = memblock_alloc_try_nid_raw(size, align, min_addr,
+                                                MEMBLOCK_ALLOC_ACCESSIBLE,
+                                                nid);
+
+       if (ptr && size > 0)
+               page_init_poison(ptr, size);
+
+       return ptr;
+}
+
 static int zone_batchsize(struct zone *zone)
 {
 #ifdef CONFIG_MMU
                end = pgdat_end_pfn(pgdat);
                end = ALIGN(end, MAX_ORDER_NR_PAGES);
                size =  (end - start) * sizeof(struct page);
-               map = memblock_alloc_node(size, SMP_CACHE_BYTES,
-                                         pgdat->node_id);
+               map = memmap_alloc(size, SMP_CACHE_BYTES, MEMBLOCK_LOW_LIMIT,
+                                  pgdat->node_id, false);
                if (!map)
                        panic("Failed to allocate %ld bytes for node %d memory map\n",
                              size, pgdat->node_id);
 
        if (map)
                return map;
 
-       map = memblock_alloc_try_nid_raw(size, size, addr,
-                                         MEMBLOCK_ALLOC_ACCESSIBLE, nid);
+       map = memmap_alloc(size, size, addr, nid, false);
        if (!map)
                panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%pa\n",
                      __func__, size, PAGE_SIZE, nid, &addr);
         * and we want it to be properly aligned to the section size - this is
         * especially the case for VMEMMAP which maps memmap to PMDs
         */
-       sparsemap_buf = memblock_alloc_exact_nid_raw(size, section_map_size(),
-                                       addr, MEMBLOCK_ALLOC_ACCESSIBLE, nid);
+       sparsemap_buf = memmap_alloc(size, section_map_size(), addr, nid, true);
        sparsemap_buf_end = sparsemap_buf + size;
 }