/* Flags for memblock allocation APIs */
 #define MEMBLOCK_ALLOC_ANYWHERE        (~(phys_addr_t)0)
 #define MEMBLOCK_ALLOC_ACCESSIBLE      0
+/*
+ *  MEMBLOCK_ALLOC_NOLEAKTRACE avoids kmemleak tracing. It implies
+ *  MEMBLOCK_ALLOC_ACCESSIBLE
+ */
 #define MEMBLOCK_ALLOC_NOLEAKTRACE     1
 
 /* We are using top down, so it is safe to use 0 here */
 
 {
        void *ptr;
 
+       /*
+        * Kmemleak will explicitly scan mem_map by traversing all valid
+        * `struct *page`,so memblock does not need to be added to the scan list.
+        */
        if (exact_nid)
                ptr = memblock_alloc_exact_nid_raw(size, align, min_addr,
-                                                  MEMBLOCK_ALLOC_ACCESSIBLE,
+                                                  MEMBLOCK_ALLOC_NOLEAKTRACE,
                                                   nid);
        else
                ptr = memblock_alloc_try_nid_raw(size, align, min_addr,
-                                                MEMBLOCK_ALLOC_ACCESSIBLE,
+                                                MEMBLOCK_ALLOC_NOLEAKTRACE,
                                                 nid);
 
        if (ptr && size > 0)
 
 #include <asm/dma.h>
 #include <asm/pgalloc.h>
 
+#include "internal.h"
+
 /*
  * Allocate a block of memory to be used to back the virtual memory map
  * or to back the page tables that are used to create the mapping.
                                unsigned long align,
                                unsigned long goal)
 {
-       return memblock_alloc_try_nid_raw(size, align, goal,
-                                              MEMBLOCK_ALLOC_ACCESSIBLE, node);
+       return memmap_alloc(size, align, goal, node, false);
 }
 
 void * __meminit vmemmap_alloc_block(unsigned long size, int node)