mm: use pgdat_end_pfn() to simplify the code in others
authorXishi Qiu <qiuxishi@huawei.com>
Tue, 12 Nov 2013 23:07:19 +0000 (15:07 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 Nov 2013 03:09:03 +0000 (12:09 +0900)
Use "pgdat_end_pfn()" instead of "pgdat->node_start_pfn +
pgdat->node_spanned_pages".  Simplify the code, no functional change.

Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/kcore.c
mm/bootmem.c
mm/memory_hotplug.c

index 06ea155e1a590530d0c16ee964107bcf54756995..5ed0e52d6aa02bcd4e4867bd1cd36f8633f9f2f1 100644 (file)
@@ -255,8 +255,7 @@ static int kcore_update_ram(void)
        end_pfn = 0;
        for_each_node_state(nid, N_MEMORY) {
                unsigned long node_end;
-               node_end  = NODE_DATA(nid)->node_start_pfn +
-                       NODE_DATA(nid)->node_spanned_pages;
+               node_end = node_end_pfn(nid);
                if (end_pfn < node_end)
                        end_pfn = node_end;
        }
index 6ab7744e692ed86cd4417041686dc3a0821cab9f..95b528cd4de732b95fd6416d3edf25521123d54c 100644 (file)
@@ -784,7 +784,7 @@ void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size,
                return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
 
        /* update goal according ...MAX_DMA32_PFN */
-       end_pfn = pgdat->node_start_pfn + pgdat->node_spanned_pages;
+       end_pfn = pgdat_end_pfn(pgdat);
 
        if (end_pfn > MAX_DMA32_PFN + (128 >> (20 - PAGE_SHIFT)) &&
            (goal >> PAGE_SHIFT) < MAX_DMA32_PFN) {
index ed85fe3870e2c5d0094d47c7aa1086084d98235e..375a42d76b2c1e38afc52f902f83106d9e16d74f 100644 (file)
@@ -365,8 +365,7 @@ out_fail:
 static void grow_pgdat_span(struct pglist_data *pgdat, unsigned long start_pfn,
                            unsigned long end_pfn)
 {
-       unsigned long old_pgdat_end_pfn =
-               pgdat->node_start_pfn + pgdat->node_spanned_pages;
+       unsigned long old_pgdat_end_pfn = pgdat_end_pfn(pgdat);
 
        if (!pgdat->node_spanned_pages || start_pfn < pgdat->node_start_pfn)
                pgdat->node_start_pfn = start_pfn;
@@ -579,9 +578,9 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
 static void shrink_pgdat_span(struct pglist_data *pgdat,
                              unsigned long start_pfn, unsigned long end_pfn)
 {
-       unsigned long pgdat_start_pfn =  pgdat->node_start_pfn;
-       unsigned long pgdat_end_pfn =
-               pgdat->node_start_pfn + pgdat->node_spanned_pages;
+       unsigned long pgdat_start_pfn = pgdat->node_start_pfn;
+       unsigned long p = pgdat_end_pfn(pgdat); /* pgdat_end_pfn namespace clash */
+       unsigned long pgdat_end_pfn = p;
        unsigned long pfn;
        struct mem_section *ms;
        int nid = pgdat->node_id;