The patch titled Subject: mm/page_alloc: do not calculate node's total pages and memmap pages when empty has been removed from the -mm tree. Its filename was mm-page_alloc-do-not-calculate-nodes-total-pages-and-memmap-pages-when-empty.patch This patch was dropped because an updated version will be merged ------------------------------------------------------ From: Oscar Salvador <osalvador@xxxxxxx> Subject: mm/page_alloc: do not calculate node's total pages and memmap pages when empty Patch series "A minor hotplug refactoring". This patch (of 3): free_area_init_node() calls calculate_node_totalpages() and free_area_init_core(). The former to get node's {spanned,present}_pages, and the latter to calculate, among other things, how many pages per zone we spent on memmap_pages, which is used to subtract zone's free pages. On memoryless nodes, it is pointless to perform such a bunch of work, so make sure we skip the calculations when having a node or empty zone. Link: https://lkml.kernel.org/r/20220307150725.6810-1-osalvador@xxxxxxx Link: https://lkml.kernel.org/r/20220307150725.6810-2-osalvador@xxxxxxx Signed-off-by: Oscar Salvador <osalvador@xxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Wei Yang <richard.weiyang@xxxxxxxxx> Cc: Miaohe Lin <linmiaohe@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/page_alloc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/mm/page_alloc.c~mm-page_alloc-do-not-calculate-nodes-total-pages-and-memmap-pages-when-empty +++ a/mm/page_alloc.c @@ -7291,6 +7291,10 @@ static void __init calculate_node_totalp unsigned long realtotalpages = 0, totalpages = 0; enum zone_type i; + /* Skip calculation for memoryless nodes */ + if (node_start_pfn == node_end_pfn) + goto no_pages; + for (i = 0; i < MAX_NR_ZONES; i++) { struct zone *zone = pgdat->node_zones + i; unsigned long zone_start_pfn, zone_end_pfn; @@ -7323,6 +7327,7 @@ static void __init calculate_node_totalp realtotalpages += real_size; } +no_pages: pgdat->node_spanned_pages = totalpages; pgdat->node_present_pages = realtotalpages; pr_debug("On node %d totalpages: %lu\n", pgdat->node_id, realtotalpages); @@ -7540,6 +7545,10 @@ static void __init free_area_init_core(s size = zone->spanned_pages; freesize = zone->present_pages; + /* No pages? Nothing to calculate then. */ + if (!size) + goto no_pages; + /* * Adjust freesize so that it accounts for how much memory * is used by this zone for memmap. This affects the watermark @@ -7575,6 +7584,7 @@ static void __init free_area_init_core(s * when the bootmem allocator frees pages into the buddy system. * And all highmem pages will be managed by the buddy system. */ +no_pages: zone_init_internals(zone, j, nid, freesize); if (!size) _ Patches currently in -mm which might be from osalvador@xxxxxxx are mm-memory_hotplug-reset-nodes-state-when-empty-during-offline.patch mm-memory_hotplug-refactor-hotadd_init_pgdat-and-try_online_node.patch