From patchwork Tue Jun 21 04:17:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 12888671 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DD99C433EF for ; Tue, 21 Jun 2022 04:17:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C88106B0073; Tue, 21 Jun 2022 00:17:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C38048E0002; Tue, 21 Jun 2022 00:17:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B00D58E0001; Tue, 21 Jun 2022 00:17:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A319E6B0073 for ; Tue, 21 Jun 2022 00:17:27 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 7601E21055 for ; Tue, 21 Jun 2022 04:17:27 +0000 (UTC) X-FDA: 79600933734.01.8FCC44B Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf10.hostedemail.com (Postfix) with ESMTP id 09D96C0096 for ; Tue, 21 Jun 2022 04:17:26 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id EC40821F36; Tue, 21 Jun 2022 04:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1655785045; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RD4sy+2BaX5dGg7b7ucLGgHHapq1SLtKUacFvTEnfcw=; b=QjIquwJYZLJwTxi8gcPBkW+f69EjNnNYPBikE5v9wlMM3rIlFRqPVmr73cSWXS4cS6RxXj 7rUVLuGDQ3cUv3csK4AiMecz0Y4ZhKFjxx2nHMBPJiC1zDuaAIZfNNy76s82Y0Qzn2BZF3 +9B3tltxCldl3aiF+QSDUqFKxJluNSM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1655785045; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RD4sy+2BaX5dGg7b7ucLGgHHapq1SLtKUacFvTEnfcw=; b=HG3iaJAln/w9mHkkdLgaE/tOq2y/oW+ySyN7n5ei2te6jezSoii+28guvjax8/oQuSAK+d Hab1RlMU5t859oCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8670813A37; Tue, 21 Jun 2022 04:17:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6G3hHVVGsWLLGwAAMHmgww (envelope-from ); Tue, 21 Jun 2022 04:17:25 +0000 From: Oscar Salvador To: Andrew Morton Cc: David Hildenbrand , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: [PATCH v2 1/2] mm/page_alloc: Do not calculate node's total pages and memmap pages when empty Date: Tue, 21 Jun 2022 06:17:16 +0200 Message-Id: <20220621041717.6355-2-osalvador@suse.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220621041717.6355-1-osalvador@suse.de> References: <20220621041717.6355-1-osalvador@suse.de> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655785047; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RD4sy+2BaX5dGg7b7ucLGgHHapq1SLtKUacFvTEnfcw=; b=n3+57sJcNrlOxwSUgHCSEowkjrCh/XUuVDkyksIpclmiOKlX1O+sJ9Gt8MQgqvujNvxnl8 lqf74SQRgomIpnkVqX8+bjxYEnKD/kNADmfaQyuxB34TWgaSQYgc6/WhUdZo9xmJ9FEufV v97vYKvuVurZgiDedHxs048gdf7qBIM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655785047; a=rsa-sha256; cv=none; b=6aS8b1Me33eTPr7qbadBEm1LRIpP2AGh7XLukL4RcJr/2NazwT6n5yVAB6UqOIaaLQzOCr atAB2tTseL/v5QRtj13Po6T2xYYppfKFX07p3Lw5lUa7INsjuvBvc+azFJ4lQ/42uc3IUM 8y5glY+ycQSeib5iwn9Sj2CCPh9AEo4= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=QjIquwJY; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=HG3iaJAl; spf=pass (imf10.hostedemail.com: domain of osalvador@suse.de designates 195.135.220.28 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de X-Stat-Signature: xo5pko9bpfd1oket68mqywetum8x4z9s Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=QjIquwJY; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=HG3iaJAl; spf=pass (imf10.hostedemail.com: domain of osalvador@suse.de designates 195.135.220.28 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de X-Rspamd-Queue-Id: 09D96C0096 X-Rspamd-Server: rspam02 X-Rspam-User: X-HE-Tag: 1655785046-865913 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 substract 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. Signed-off-by: Oscar Salvador Reviewed-by: David Hildenbrand --- mm/page_alloc.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e008a3df0485..2b9b2422ba32 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7361,6 +7361,10 @@ static void __init calculate_node_totalpages(struct pglist_data *pgdat, unsigned long realtotalpages = 0, totalpages = 0; enum zone_type i; + /* Skip calculation for memoryless nodes */ + if (pgdat_is_empty(pgdat)) + 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; @@ -7393,6 +7397,7 @@ static void __init calculate_node_totalpages(struct pglist_data *pgdat, 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); @@ -7610,6 +7615,12 @@ static void __init free_area_init_core(struct pglist_data *pgdat) size = zone->spanned_pages; freesize = zone->present_pages; + /* No pages? Nothing to calculate then. */ + if (!size) { + zone_init_internals(zone, j, nid, 0); + continue; + } + /* * Adjust freesize so that it accounts for how much memory * is used by this zone for memmap. This affects the watermark @@ -7647,9 +7658,6 @@ static void __init free_area_init_core(struct pglist_data *pgdat) */ zone_init_internals(zone, j, nid, freesize); - if (!size) - continue; - set_pageblock_order(); setup_usemap(zone); init_currently_empty_zone(zone, zone->zone_start_pfn, size); @@ -7730,7 +7738,7 @@ static void __init free_area_init_node(int nid) pgdat->node_start_pfn = start_pfn; pgdat->per_cpu_nodestats = NULL; - if (start_pfn != end_pfn) { + if (!pgdat_is_empty(pgdat)) { pr_info("Initmem setup node %d [mem %#018Lx-%#018Lx]\n", nid, (u64)start_pfn << PAGE_SHIFT, end_pfn ? ((u64)end_pfn << PAGE_SHIFT) - 1 : 0); From patchwork Tue Jun 21 04:17:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 12888672 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9027CCA47E for ; Tue, 21 Jun 2022 04:17:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 759516B0074; Tue, 21 Jun 2022 00:17:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E1B08E0002; Tue, 21 Jun 2022 00:17:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5A97E8E0001; Tue, 21 Jun 2022 00:17:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 4E5336B0074 for ; Tue, 21 Jun 2022 00:17:29 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 2810A80E9E for ; Tue, 21 Jun 2022 04:17:29 +0000 (UTC) X-FDA: 79600933818.29.817F22F Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf14.hostedemail.com (Postfix) with ESMTP id A2D38100089 for ; Tue, 21 Jun 2022 04:17:28 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 441341FACA; Tue, 21 Jun 2022 04:17:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1655785047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CI4MutXCq5wn++5tZfCUAUSAO/EBZH3FYFdKsBVxi5c=; b=Zp9uc4ylYWdQmVbsmB+3Y7P+PPEK7boxUaRYEaWCwYTaOjwQgQeU6qSRD4IdMkFjbJ+IuV A6QHzVm8mnFfb7ahnxP6KaKIaPv0S2JgN8OB9wV8mVxkG9LrJJxwO35jGvWgc2UeMiwkwC 3k3guW9j6yoksYvNSjlEU2Bx6x4BDgo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1655785047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CI4MutXCq5wn++5tZfCUAUSAO/EBZH3FYFdKsBVxi5c=; b=ogovL0jpGPTg8q2GwJpwyrKKlKJRF+cDa4xytmAdB0fkGjFN7sZl1AP4rmis9SEpFxcvBV gBdPoh9LqjPvZDDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D332A13A37; Tue, 21 Jun 2022 04:17:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QG6yMFZGsWLLGwAAMHmgww (envelope-from ); Tue, 21 Jun 2022 04:17:26 +0000 From: Oscar Salvador To: Andrew Morton Cc: David Hildenbrand , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: [PATCH v2 2/2] mm/memory_hotplug: Reset node's state when empty during offline Date: Tue, 21 Jun 2022 06:17:17 +0200 Message-Id: <20220621041717.6355-3-osalvador@suse.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220621041717.6355-1-osalvador@suse.de> References: <20220621041717.6355-1-osalvador@suse.de> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Zp9uc4yl; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=ogovL0jp; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf14.hostedemail.com: domain of osalvador@suse.de designates 195.135.220.29 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655785048; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CI4MutXCq5wn++5tZfCUAUSAO/EBZH3FYFdKsBVxi5c=; b=AlHvMzpvAW0bqqlK7oG6lmggeH7aeAGeELIlZ+yY1zqWXxdz9vY1w8zdgVaD0q2X991pIs lFp73HUE50/ZSeuHN+aie19WgQQj2kix0Q6iBiFNZqxuF6WylrWNQBjR4BbOd8z8MPpVmY YDoSuu+r8I1WYT8XERhI3Qs0UOoaY0M= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655785048; a=rsa-sha256; cv=none; b=TieJADxcPnO3YzsseHdruvMtsmVZlZzWsqmNZ4eeksob6DG6aHOSNYuvvd5wuk+9w389Bi xftm+KlhIetFYhOayECgUo4kTXMo1sTfMp/0+53fOssFbhBtiDrocr7BsCvOR4sRWEFM2k xsbAQmc8ac1isD2hfDZIDJ7p28eMt2g= X-Stat-Signature: bcdzyq75zuuxewc1u4kftpxudayfeqxj X-Rspamd-Queue-Id: A2D38100089 X-Rspam-User: Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Zp9uc4yl; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=ogovL0jp; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf14.hostedemail.com: domain of osalvador@suse.de designates 195.135.220.29 as permitted sender) smtp.mailfrom=osalvador@suse.de X-Rspamd-Server: rspam10 X-HE-Tag: 1655785048-111221 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: All possible nodes are now pre-allocated at boot time by free_area_init()-> free_area_init_node(), and those which are to be hot-plugged are initialized later on by hotadd_init_pgdat()->free_area_init_core_hotplug() when they become online. free_area_init_core_hotplug() calls pgdat_init_internals() and zone_init_internals() to initialize some internal data structures and zeroes a few pgdat fields. But we do already call pgdat_init_internals() and zone_init_internals() for all possible nodes back in free_area_init_core(), and pgdat fields are already zeroed because the pre-allocation memsets with 0s the structure, meaning we do not need to repeat the process when the node becomes online. So initialize it only once when booting, and make sure to reset the fields we care about to 0 when the node goes empty. The only thing we need to check for is to allocate per_cpu_nodestats struct the very first time this node goes online. node_reset_state() is the function in charge of resetting pgdat's fields, and it is called when offline_pages() detects that the node becomes empty worth of memory. Signed-off-by: Oscar Salvador --- include/linux/memory_hotplug.h | 2 +- mm/memory_hotplug.c | 54 ++++++++++++++++++++-------------- mm/page_alloc.c | 49 +++++------------------------- 3 files changed, 41 insertions(+), 64 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 20d7edf62a6a..917112661b5c 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -319,7 +319,7 @@ extern void set_zone_contiguous(struct zone *zone); extern void clear_zone_contiguous(struct zone *zone); #ifdef CONFIG_MEMORY_HOTPLUG -extern void __ref free_area_init_core_hotplug(struct pglist_data *pgdat); +extern bool pgdat_has_boot_nodestats(pg_data_t *pgdat); extern int __add_memory(int nid, u64 start, u64 size, mhp_t mhp_flags); extern int add_memory(int nid, u64 start, u64 size, mhp_t mhp_flags); extern int add_memory_resource(int nid, struct resource *resource, diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 1213d0c67a53..8a464cdd44ad 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1176,18 +1176,18 @@ static void reset_node_present_pages(pg_data_t *pgdat) /* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */ static pg_data_t __ref *hotadd_init_pgdat(int nid) { - struct pglist_data *pgdat; + struct pglist_data *pgdat = NODE_DATA(nid); /* - * NODE_DATA is preallocated (free_area_init) but its internal - * state is not allocated completely. Add missing pieces. - * Completely offline nodes stay around and they just need - * reintialization. + * NODE_DATA is preallocated (free_area_init), the only thing missing + * is to allocate its per_cpu_nodestats struct and to build node's + * zonelists. The allocation of per_cpu_nodestats only needs to be done + * the very first time this node is brought up, as we reset its state + * when all node's memory goes offline. */ - pgdat = NODE_DATA(nid); - - /* init node's zones as empty zones, we don't have any present pages.*/ - free_area_init_core_hotplug(pgdat); + if (pgdat_has_boot_nodestats(pgdat)) + pgdat->per_cpu_nodestats = alloc_percpu_gfp(struct per_cpu_nodestat, + __GFP_ZERO); /* * The node we allocated has no zone fallback lists. For avoiding @@ -1195,15 +1195,6 @@ static pg_data_t __ref *hotadd_init_pgdat(int nid) */ build_all_zonelists(pgdat); - /* - * When memory is hot-added, all the memory is in offline state. So - * clear all zones' present_pages because they will be updated in - * online_pages() and offline_pages(). - * TODO: should be in free_area_init_core_hotplug? - */ - reset_node_managed_pages(pgdat); - reset_node_present_pages(pgdat); - return pgdat; } @@ -1780,6 +1771,26 @@ static void node_states_clear_node(int node, struct memory_notify *arg) node_clear_state(node, N_MEMORY); } +static void node_reset_state(int node) +{ + pg_data_t *pgdat = NODE_DATA(node); + int cpu; + + kswapd_stop(node); + kcompactd_stop(node); + + pgdat->nr_zones = 0; + pgdat->kswapd_order = 0; + pgdat->kswapd_highest_zoneidx = 0; + + for_each_online_cpu(cpu) { + struct per_cpu_nodestat *p; + + p = per_cpu_ptr(pgdat->per_cpu_nodestats, cpu); + memset(p, 0, sizeof(*p)); + } +} + static int count_system_ram_pages_cb(unsigned long start_pfn, unsigned long nr_pages, void *data) { @@ -1940,10 +1951,9 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages, } node_states_clear_node(node, &arg); - if (arg.status_change_nid >= 0) { - kswapd_stop(node); - kcompactd_stop(node); - } + if (arg.status_change_nid >= 0) + /* Reset node's state as all its memory went offline. */ + node_reset_state(node); writeback_set_ratelimit(); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 2b9b2422ba32..384bb5a50743 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6416,6 +6416,13 @@ static DEFINE_PER_CPU(struct per_cpu_pages, boot_pageset); static DEFINE_PER_CPU(struct per_cpu_zonestat, boot_zonestats); DEFINE_PER_CPU(struct per_cpu_nodestat, boot_nodestats); +#ifdef CONFIG_MEMORY_HOTPLUG +bool pgdat_has_boot_nodestats(pg_data_t *pgdat) +{ + return pgdat->per_cpu_nodestats == &boot_nodestats; +} +#endif + static void __build_all_zonelists(void *data) { int nid; @@ -7539,7 +7546,7 @@ static void __meminit pgdat_init_internals(struct pglist_data *pgdat) lruvec_init(&pgdat->__lruvec); } -static void __meminit zone_init_internals(struct zone *zone, enum zone_type idx, int nid, +static void __init zone_init_internals(struct zone *zone, enum zone_type idx, int nid, unsigned long remaining_pages) { atomic_long_set(&zone->managed_pages, remaining_pages); @@ -7551,46 +7558,6 @@ static void __meminit zone_init_internals(struct zone *zone, enum zone_type idx, zone_pcp_init(zone); } -/* - * Set up the zone data structures - * - init pgdat internals - * - init all zones belonging to this node - * - * NOTE: this function is only called during memory hotplug - */ -#ifdef CONFIG_MEMORY_HOTPLUG -void __ref free_area_init_core_hotplug(struct pglist_data *pgdat) -{ - int nid = pgdat->node_id; - enum zone_type z; - int cpu; - - pgdat_init_internals(pgdat); - - if (pgdat->per_cpu_nodestats == &boot_nodestats) - pgdat->per_cpu_nodestats = alloc_percpu(struct per_cpu_nodestat); - - /* - * Reset the nr_zones, order and highest_zoneidx before reuse. - * Note that kswapd will init kswapd_highest_zoneidx properly - * when it starts in the near future. - */ - pgdat->nr_zones = 0; - pgdat->kswapd_order = 0; - pgdat->kswapd_highest_zoneidx = 0; - pgdat->node_start_pfn = 0; - for_each_online_cpu(cpu) { - struct per_cpu_nodestat *p; - - p = per_cpu_ptr(pgdat->per_cpu_nodestats, cpu); - memset(p, 0, sizeof(*p)); - } - - for (z = 0; z < MAX_NR_ZONES; z++) - zone_init_internals(&pgdat->node_zones[z], z, nid, 0); -} -#endif - /* * Set up the zone data structures: * - mark all pages reserved