Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
[platform/kernel/linux-rpi.git] / arch / arm64 / mm / init.c
index 24db0ad..75addb3 100644 (file)
@@ -447,71 +447,6 @@ void __init bootmem_init(void)
        memblock_dump_all();
 }
 
-#ifndef CONFIG_SPARSEMEM_VMEMMAP
-static inline void free_memmap(unsigned long start_pfn, unsigned long end_pfn)
-{
-       struct page *start_pg, *end_pg;
-       unsigned long pg, pgend;
-
-       /*
-        * Convert start_pfn/end_pfn to a struct page pointer.
-        */
-       start_pg = pfn_to_page(start_pfn - 1) + 1;
-       end_pg = pfn_to_page(end_pfn - 1) + 1;
-
-       /*
-        * Convert to physical addresses, and round start upwards and end
-        * downwards.
-        */
-       pg = (unsigned long)PAGE_ALIGN(__pa(start_pg));
-       pgend = (unsigned long)__pa(end_pg) & PAGE_MASK;
-
-       /*
-        * If there are free pages between these, free the section of the
-        * memmap array.
-        */
-       if (pg < pgend)
-               memblock_free(pg, pgend - pg);
-}
-
-/*
- * The mem_map array can get very big. Free the unused area of the memory map.
- */
-static void __init free_unused_memmap(void)
-{
-       unsigned long start, end, prev_end = 0;
-       int i;
-
-       for_each_mem_pfn_range(i, MAX_NUMNODES, &start, &end, NULL) {
-#ifdef CONFIG_SPARSEMEM
-               /*
-                * Take care not to free memmap entries that don't exist due
-                * to SPARSEMEM sections which aren't present.
-                */
-               start = min(start, ALIGN(prev_end, PAGES_PER_SECTION));
-#endif
-               /*
-                * If we had a previous bank, and there is a space between the
-                * current bank and the previous, free it.
-                */
-               if (prev_end && prev_end < start)
-                       free_memmap(prev_end, start);
-
-               /*
-                * Align up here since the VM subsystem insists that the
-                * memmap entries are valid from the bank end aligned to
-                * MAX_ORDER_NR_PAGES.
-                */
-               prev_end = ALIGN(end, MAX_ORDER_NR_PAGES);
-       }
-
-#ifdef CONFIG_SPARSEMEM
-       if (!IS_ALIGNED(prev_end, PAGES_PER_SECTION))
-               free_memmap(prev_end, ALIGN(prev_end, PAGES_PER_SECTION));
-#endif
-}
-#endif /* !CONFIG_SPARSEMEM_VMEMMAP */
-
 /*
  * mem_init() marks the free areas in the mem_map and tells us how much memory
  * is free.  This is done after various parts of the system have claimed their
@@ -527,9 +462,6 @@ void __init mem_init(void)
 
        set_max_mapnr(max_pfn - PHYS_PFN_OFFSET);
 
-#ifndef CONFIG_SPARSEMEM_VMEMMAP
-       free_unused_memmap();
-#endif
        /* this will put all unused low memory onto the freelists */
        memblock_free_all();