mm/page_alloc: remove realsize in free_area_init_core()
Subsystems (2)
PATCH 1/1 mm/page_alloc: remove realsize in free_area_init_core()
Highmem's realsize always equals to freesize, so it is not necessary to spare a variable to record this.
Signed-off-by Wei Yang <[email protected]>
--- mm/page_alloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
mm/page_alloc.c +4 -4
@@ -6104,18 +6104,18 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat)for (j =0 ; j <MAX_NR_ZONES ; j++) {struct zone *zone = pgdat->node_zones + j; -unsigned long size, realsize, freesize, memmap_pages; +unsigned long size, freesize, memmap_pages;unsigned long zone_start_pfn = zone->zone_start_pfn; size = zone->spanned_pages; - realsize = freesize = zone->present_pages; + freesize = zone->present_pages;/* * Adjust freesize so that it accounts for how much memory * is used by this zone for memmap. This affects the watermark * and per-cpu initialisations */ - memmap_pages =calc_memmap_size (size, realsize); + memmap_pages =calc_memmap_size (size, freesize);if (!is_highmem_idx (j)) {if (freesize >= memmap_pages) { freesize -= memmap_pages;
@@ -6147,7 +6147,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat)* when the bootmem allocator frees pages into the buddy system. * And all highmem pages will be managed by the buddy system. */ - zone->managed_pages =is_highmem_idx (j) ? realsize : freesize; + zone->managed_pages = freesize;#ifdef CONFIG_NUMA zone->node = nid;#endif
Signature · 1 line
2.15.1
Andrew Morton
maintainerQuoted 2 lines · On Fri, 13 Apr 2018 16:38:59 +0800 Wei Yang <[email protected]> wrote:
Highmem's realsize always equals to freesize, so it is not necessary to spare a variable to record this.
Agreed. The code seems a bit more fragile after this alteration, but I guess the onus is on us, as always, to not screw it up later on. hm..