mm: page_alloc: pass PFN to __free_pages_bootmem
authorMel Gorman <mgorman@suse.de>
Tue, 30 Jun 2015 21:56:52 +0000 (14:56 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 1 Jul 2015 02:44:55 +0000 (19:44 -0700)
__free_pages_bootmem prepares a page for release to the buddy allocator
and assumes that the struct page is initialised.  Parallel initialisation
of struct pages defers initialisation and __free_pages_bootmem can be
called for struct pages that cannot yet map struct page to PFN.  This
patch passes PFN to __free_pages_bootmem with no other functional change.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Tested-by: Nate Zimmer <nzimmer@sgi.com>
Tested-by: Waiman Long <waiman.long@hp.com>
Tested-by: Daniel J Blueman <daniel@numascale.com>
Acked-by: Pekka Enberg <penberg@kernel.org>
Cc: Robin Holt <robinmholt@gmail.com>
Cc: Nate Zimmer <nzimmer@sgi.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Waiman Long <waiman.long@hp.com>
Cc: Scott Norton <scott.norton@hp.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/bootmem.c
mm/internal.h
mm/memblock.c
mm/nobootmem.c
mm/page_alloc.c

index 477be696511d669230b47c73d52a8b3c1836c457..a23dd19346548223152a4922a0e2e7d90cb56b10 100644 (file)
@@ -164,7 +164,7 @@ void __init free_bootmem_late(unsigned long physaddr, unsigned long size)
        end = PFN_DOWN(physaddr + size);
 
        for (; cursor < end; cursor++) {
-               __free_pages_bootmem(pfn_to_page(cursor), 0);
+               __free_pages_bootmem(pfn_to_page(cursor), cursor, 0);
                totalram_pages++;
        }
 }
@@ -172,7 +172,7 @@ void __init free_bootmem_late(unsigned long physaddr, unsigned long size)
 static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
 {
        struct page *page;
-       unsigned long *map, start, end, pages, count = 0;
+       unsigned long *map, start, end, pages, cur, count = 0;
 
        if (!bdata->node_bootmem_map)
                return 0;
@@ -210,17 +210,17 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
                if (IS_ALIGNED(start, BITS_PER_LONG) && vec == ~0UL) {
                        int order = ilog2(BITS_PER_LONG);
 
-                       __free_pages_bootmem(pfn_to_page(start), order);
+                       __free_pages_bootmem(pfn_to_page(start), start, order);
                        count += BITS_PER_LONG;
                        start += BITS_PER_LONG;
                } else {
-                       unsigned long cur = start;
+                       cur = start;
 
                        start = ALIGN(start + 1, BITS_PER_LONG);
                        while (vec && cur != start) {
                                if (vec & 1) {
                                        page = pfn_to_page(cur);
-                                       __free_pages_bootmem(page, 0);
+                                       __free_pages_bootmem(page, cur, 0);
                                        count++;
                                }
                                vec >>= 1;
@@ -229,12 +229,13 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
                }
        }
 
+       cur = bdata->node_min_pfn;
        page = virt_to_page(bdata->node_bootmem_map);
        pages = bdata->node_low_pfn - bdata->node_min_pfn;
        pages = bootmem_bootmap_pages(pages);
        count += pages;
        while (pages--)
-               __free_pages_bootmem(page++, 0);
+               __free_pages_bootmem(page++, cur++, 0);
 
        bdebug("nid=%td released=%lx\n", bdata - bootmem_node_data, count);
 
index a25e359a40396c9db36042e632b96fd912e99ded..58e9022e37570c43a5069fb4ecf8aabfe827928e 100644 (file)
@@ -155,7 +155,8 @@ __find_buddy_index(unsigned long page_idx, unsigned int order)
 }
 
 extern int __isolate_free_page(struct page *page, unsigned int order);
-extern void __free_pages_bootmem(struct page *page, unsigned int order);
+extern void __free_pages_bootmem(struct page *page, unsigned long pfn,
+                                       unsigned int order);
 extern void prep_compound_page(struct page *page, unsigned long order);
 #ifdef CONFIG_MEMORY_FAILURE
 extern bool is_free_buddy_page(struct page *page);
index 114df622853f13a2118f4698687c67a3090e5b4c..87108e77e476a326d69ec748f4e300d713fbd192 100644 (file)
@@ -1419,7 +1419,7 @@ void __init __memblock_free_late(phys_addr_t base, phys_addr_t size)
        end = PFN_DOWN(base + size);
 
        for (; cursor < end; cursor++) {
-               __free_pages_bootmem(pfn_to_page(cursor), 0);
+               __free_pages_bootmem(pfn_to_page(cursor), cursor, 0);
                totalram_pages++;
        }
 }
index 4af8f88c2bd11fe1c25207269a4557dd9672e4c8..e57cf24babd671c0757eaf320673777774a0658c 100644 (file)
@@ -86,7 +86,7 @@ void __init free_bootmem_late(unsigned long addr, unsigned long size)
        end = PFN_DOWN(addr + size);
 
        for (; cursor < end; cursor++) {
-               __free_pages_bootmem(pfn_to_page(cursor), 0);
+               __free_pages_bootmem(pfn_to_page(cursor), cursor, 0);
                totalram_pages++;
        }
 }
@@ -101,7 +101,7 @@ static void __init __free_pages_memory(unsigned long start, unsigned long end)
                while (start + (1UL << order) > end)
                        order--;
 
-               __free_pages_bootmem(pfn_to_page(start), order);
+               __free_pages_bootmem(pfn_to_page(start), start, order);
 
                start += (1UL << order);
        }
index 39c8d56a40565cbbda67bec819fb2b07fa1abf03..c2ee4ecad083f897d9ce181492502f48645e0bc3 100644 (file)
@@ -878,7 +878,8 @@ static void __free_pages_ok(struct page *page, unsigned int order)
        local_irq_restore(flags);
 }
 
-void __init __free_pages_bootmem(struct page *page, unsigned int order)
+void __init __free_pages_bootmem(struct page *page, unsigned long pfn,
+                                                       unsigned int order)
 {
        unsigned int nr_pages = 1 << order;
        struct page *p = page;