From nobody Tue Jun 30 02:38:54 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44702C433FE for ; Thu, 27 Jan 2022 08:53:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237959AbiA0IxV (ORCPT ); Thu, 27 Jan 2022 03:53:21 -0500 Received: from mail-ed1-f50.google.com ([209.85.208.50]:36526 "EHLO mail-ed1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237928AbiA0IxP (ORCPT ); Thu, 27 Jan 2022 03:53:15 -0500 Received: by mail-ed1-f50.google.com with SMTP id l5so2642702edv.3 for ; Thu, 27 Jan 2022 00:53:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3eRPJB+YqZd2ZZyxQgtAYtqZKGBXjpCE6LW/md0SNnk=; b=ZiDM3r/4FN/eIx4eTMDLJIYktBCjJfC6SDL86Yr8AXq8aMq/6YT/mk2xJG1UZaYM7B LxUwcmsCNanoMmAP7aP/2RZtwvrmWg1epkMXifeCA+NkqeyDiMUENM3J1dN4WIjbFZ4i w+nBRKxBUPyCB1XqifkYq3AuBADc4BMky9G8snI69XIA7BJats1h7VesLomqZm0Qjb3L 0Qm8wQ+InKx0gm/GLyevYx/dBYjlwOtjdc5lkWzOMeifuvoygZRVLMfEqa7vq3oWkcV1 H2eTkyHEl3QkbJkcvJNS7yIvANfcxiiCv0SbeOl7UMZjo+9B5UZc1qO2cTDwUCbwe7FR eZ4g== X-Gm-Message-State: AOAM533RxCaM0MAoMFccc0S5CYH9htpODfRELWH7hCmivXvC5ke4+ZFa AQPwz6flVqHCqYh+QHRPT6c= X-Google-Smtp-Source: ABdhPJwyOcD75d86+ZTjwDWy3uRlg8yr9BNyaeejl1+lf/7zitkPNj75Ine1VgyGWCJsNwqIPaPqvA== X-Received: by 2002:a05:6402:4414:: with SMTP id y20mr2600218eda.219.1643273594768; Thu, 27 Jan 2022 00:53:14 -0800 (PST) Received: from localhost.localdomain (ip-85-160-47-31.eurotel.cz. [85.160.47.31]) by smtp.gmail.com with ESMTPSA id n11sm11029757edv.52.2022.01.27.00.53.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 00:53:14 -0800 (PST) From: Michal Hocko To: Andrew Morton Cc: , LKML , David Hildenbrand , Alexey Makhalov , Dennis Zhou , Eric Dumazet , Oscar Salvador , Tejun Heo , Christoph Lameter , Nico Pache , Wei Yang , Rafael Aquini , Michal Hocko Subject: [PATCH 1/6] mm, memory_hotplug: make arch_alloc_nodedata independent on CONFIG_MEMORY_HOTPLUG Date: Thu, 27 Jan 2022 09:53:00 +0100 Message-Id: <20220127085305.20890-2-mhocko@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220127085305.20890-1-mhocko@kernel.org> References: <20220127085305.20890-1-mhocko@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Hocko This is a preparatory patch and it doesn't introduce any functional change. It merely pulls out arch_alloc_nodedata (and co) outside of CONFIG_MEMORY_HOTPLUG because the following patch will need to call this from the generic MM code. Acked-by: Rafael Aquini Signed-off-by: Michal Hocko Acked-by: David Hildenbrand Acked-by: Mike Rapoport Reviewed-by: Oscar Salvador Reviewed-by: Wei Yang --- arch/ia64/mm/discontig.c | 2 - include/linux/memory_hotplug.h | 119 ++++++++++++++++----------------- 2 files changed, 59 insertions(+), 62 deletions(-) diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c index 791d4176e4a6..8dc8a554f774 100644 --- a/arch/ia64/mm/discontig.c +++ b/arch/ia64/mm/discontig.c @@ -608,7 +608,6 @@ void __init paging_init(void) zero_page_memmap_ptr =3D virt_to_page(ia64_imva(empty_zero_page)); } =20 -#ifdef CONFIG_MEMORY_HOTPLUG pg_data_t *arch_alloc_nodedata(int nid) { unsigned long size =3D compute_pernodesize(nid); @@ -626,7 +625,6 @@ void arch_refresh_nodedata(int update_node, pg_data_t *= update_pgdat) pgdat_list[update_node] =3D update_pgdat; scatter_node_data(); } -#endif =20 #ifdef CONFIG_SPARSEMEM_VMEMMAP int __meminit vmemmap_populate(unsigned long start, unsigned long end, int= node, diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index be48e003a518..4355983b364d 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -16,6 +16,65 @@ struct memory_group; struct resource; struct vmem_altmap; =20 +#ifdef CONFIG_HAVE_ARCH_NODEDATA_EXTENSION +/* + * For supporting node-hotadd, we have to allocate a new pgdat. + * + * If an arch has generic style NODE_DATA(), + * node_data[nid] =3D kzalloc() works well. But it depends on the architec= ture. + * + * In general, generic_alloc_nodedata() is used. + * Now, arch_free_nodedata() is just defined for error path of node_hot_ad= d. + * + */ +extern pg_data_t *arch_alloc_nodedata(int nid); +extern void arch_free_nodedata(pg_data_t *pgdat); +extern void arch_refresh_nodedata(int nid, pg_data_t *pgdat); + +#else /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ + +#define arch_alloc_nodedata(nid) generic_alloc_nodedata(nid) +#define arch_free_nodedata(pgdat) generic_free_nodedata(pgdat) + +#ifdef CONFIG_NUMA +/* + * XXX: node aware allocation can't work well to get new node's memory at = this time. + * Because, pgdat for the new node is not allocated/initialized yet itself. + * To use new node's memory, more consideration will be necessary. + */ +#define generic_alloc_nodedata(nid) \ +({ \ + kzalloc(sizeof(pg_data_t), GFP_KERNEL); \ +}) +/* + * This definition is just for error path in node hotadd. + * For node hotremove, we have to replace this. + */ +#define generic_free_nodedata(pgdat) kfree(pgdat) + +extern pg_data_t *node_data[]; +static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat) +{ + node_data[nid] =3D pgdat; +} + +#else /* !CONFIG_NUMA */ + +/* never called */ +static inline pg_data_t *generic_alloc_nodedata(int nid) +{ + BUG(); + return NULL; +} +static inline void generic_free_nodedata(pg_data_t *pgdat) +{ +} +static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat) +{ +} +#endif /* CONFIG_NUMA */ +#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ + #ifdef CONFIG_MEMORY_HOTPLUG struct page *pfn_to_online_page(unsigned long pfn); =20 @@ -154,66 +213,6 @@ int add_pages(int nid, unsigned long start_pfn, unsign= ed long nr_pages, struct mhp_params *params); #endif /* ARCH_HAS_ADD_PAGES */ =20 -#ifdef CONFIG_HAVE_ARCH_NODEDATA_EXTENSION -/* - * For supporting node-hotadd, we have to allocate a new pgdat. - * - * If an arch has generic style NODE_DATA(), - * node_data[nid] =3D kzalloc() works well. But it depends on the architec= ture. - * - * In general, generic_alloc_nodedata() is used. - * Now, arch_free_nodedata() is just defined for error path of node_hot_ad= d. - * - */ -extern pg_data_t *arch_alloc_nodedata(int nid); -extern void arch_free_nodedata(pg_data_t *pgdat); -extern void arch_refresh_nodedata(int nid, pg_data_t *pgdat); - -#else /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ - -#define arch_alloc_nodedata(nid) generic_alloc_nodedata(nid) -#define arch_free_nodedata(pgdat) generic_free_nodedata(pgdat) - -#ifdef CONFIG_NUMA -/* - * If ARCH_HAS_NODEDATA_EXTENSION=3Dn, this func is used to allocate pgdat. - * XXX: kmalloc_node() can't work well to get new node's memory at this ti= me. - * Because, pgdat for the new node is not allocated/initialized yet itself. - * To use new node's memory, more consideration will be necessary. - */ -#define generic_alloc_nodedata(nid) \ -({ \ - kzalloc(sizeof(pg_data_t), GFP_KERNEL); \ -}) -/* - * This definition is just for error path in node hotadd. - * For node hotremove, we have to replace this. - */ -#define generic_free_nodedata(pgdat) kfree(pgdat) - -extern pg_data_t *node_data[]; -static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat) -{ - node_data[nid] =3D pgdat; -} - -#else /* !CONFIG_NUMA */ - -/* never called */ -static inline pg_data_t *generic_alloc_nodedata(int nid) -{ - BUG(); - return NULL; -} -static inline void generic_free_nodedata(pg_data_t *pgdat) -{ -} -static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat) -{ -} -#endif /* CONFIG_NUMA */ -#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ - void get_online_mems(void); void put_online_mems(void); =20 --=20 2.30.2 From nobody Tue Jun 30 02:38:54 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7D3CC433F5 for ; Thu, 27 Jan 2022 08:53:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237988AbiA0IxZ (ORCPT ); Thu, 27 Jan 2022 03:53:25 -0500 Received: from mail-ed1-f47.google.com ([209.85.208.47]:40738 "EHLO mail-ed1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237933AbiA0IxR (ORCPT ); Thu, 27 Jan 2022 03:53:17 -0500 Received: by mail-ed1-f47.google.com with SMTP id w25so1795735edt.7 for ; Thu, 27 Jan 2022 00:53:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aOJjl+XOvtbHeHVkKZ6L9gOjlOV4TSrP1aRrCtm5TiU=; b=GGxJWdd6gtUgVyS76bu3VGFunQ1WR68Q/BjYixePp8jv+x4ITmmZT27l7sjg78HiHY Vb3DON5yaMM+2Y6j5DnosTaJH1bJSnawjdQ0V+q1KJdmmTGq0NWzI9rDXoV3HXTcpEdI 9BqV26B+oeHwJPSBwDHfVLj6Fb/6wJRj/ep26JKxBSigveVqRYsXCLm6siexygNMfoBY xqFPfIWyj9QozAc0fNXPoPYNibLPk9BO/pnLHP/kzDgFeACOovcsXs8voDhYK4uZX6qt 6agfGnHLGDtZEVnbZhNiAD6Hvmo/ktDmR+nVpA40rNza/9PkAYNScIx0OqM8ZwRTr78F tVcA== X-Gm-Message-State: AOAM532LF6rO/GYGApS2opf+vwkRvy286isGe6wBNY5OtWdVSIwqoXae 0nHpDJum/+1K5qFWOoKBoSE= X-Google-Smtp-Source: ABdhPJw+CJMGc5X3Abo/UmdIhGP4pFgOh89fjOHpk7Sgxdhk1u0V6Bvk6N43DHmU931XroDTv5E9+Q== X-Received: by 2002:aa7:cdd9:: with SMTP id h25mr2652972edw.95.1643273596216; Thu, 27 Jan 2022 00:53:16 -0800 (PST) Received: from localhost.localdomain (ip-85-160-47-31.eurotel.cz. [85.160.47.31]) by smtp.gmail.com with ESMTPSA id n11sm11029757edv.52.2022.01.27.00.53.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 00:53:15 -0800 (PST) From: Michal Hocko To: Andrew Morton Cc: , LKML , David Hildenbrand , Alexey Makhalov , Dennis Zhou , Eric Dumazet , Oscar Salvador , Tejun Heo , Christoph Lameter , Nico Pache , Wei Yang , Rafael Aquini , Michal Hocko Subject: [PATCH 2/6] mm: handle uninitialized numa nodes gracefully Date: Thu, 27 Jan 2022 09:53:01 +0100 Message-Id: <20220127085305.20890-3-mhocko@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220127085305.20890-1-mhocko@kernel.org> References: <20220127085305.20890-1-mhocko@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Hocko We have had several reports [1][2][3] that page allocator blows up when an allocation from a possible node is requested. The underlying reason is that NODE_DATA for the specific node is not allocated. NUMA specific initialization is arch specific and it can vary a lot. E.g. x86 tries to initialize all nodes that have some cpu affinity (see init_cpu_to_node) but this can be insufficient because the node might be cpuless for example. One way to address this problem would be to check for !node_online nodes when trying to get a zonelist and silently fall back to another node. That is unfortunately adding a branch into allocator hot path and it doesn't handle any other potential NODE_DATA users. This patch takes a different approach (following a lead of [3]) and it pre allocates pgdat for all possible nodes in an arch indipendent code - free_area_init. All uninitialized nodes are treated as memoryless nodes. node_state of the node is not changed because that would lead to other side effects - e.g. sysfs representation of such a node and from past discussions [4] it is known that some tools might have problems digesting that. Newly allocated pgdat only gets a minimal initialization and the rest of the work is expected to be done by the memory hotplug - hotadd_new_pgdat (renamed to hotadd_init_pgdat). generic_alloc_nodedata is changed to use the memblock allocator because neither page nor slab allocators are available at the stage when all pgdats are allocated. Hotplug doesn't allocate pgdat anymore so we can use the early boot allocator. The only arch specific implementation is ia64 and that is changed to use the early allocator as well. Reported-by: Alexey Makhalov Tested-by: Alexey Makhalov Reported-by: Nico Pache Acked-by: Rafael Aquini Tested-by: Rafael Aquini Signed-off-by: Michal Hocko [1] http://lkml.kernel.org/r/20211101201312.11589-1-amakhalov@vmware.com [2] http://lkml.kernel.org/r/20211207224013.880775-1-npache@redhat.com [3] http://lkml.kernel.org/r/20190114082416.30939-1-mhocko@kernel.org [4] http://lkml.kernel.org/r/20200428093836.27190-1-srikar@linux.vnet.ibm.c= om --- arch/ia64/mm/discontig.c | 4 ++-- include/linux/memory_hotplug.h | 2 +- mm/memory_hotplug.c | 21 +++++++++------------ mm/page_alloc.c | 34 +++++++++++++++++++++++++++++++--- 4 files changed, 43 insertions(+), 18 deletions(-) diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c index 8dc8a554f774..dd0cf4834eaa 100644 --- a/arch/ia64/mm/discontig.c +++ b/arch/ia64/mm/discontig.c @@ -608,11 +608,11 @@ void __init paging_init(void) zero_page_memmap_ptr =3D virt_to_page(ia64_imva(empty_zero_page)); } =20 -pg_data_t *arch_alloc_nodedata(int nid) +pg_data_t * __init arch_alloc_nodedata(int nid) { unsigned long size =3D compute_pernodesize(nid); =20 - return kzalloc(size, GFP_KERNEL); + return memblock_alloc(size, SMP_CACHE_BYTES); } =20 void arch_free_nodedata(pg_data_t *pgdat) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 4355983b364d..cdd66bfdf855 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -44,7 +44,7 @@ extern void arch_refresh_nodedata(int nid, pg_data_t *pgd= at); */ #define generic_alloc_nodedata(nid) \ ({ \ - kzalloc(sizeof(pg_data_t), GFP_KERNEL); \ + memblock_alloc(sizeof(*pgdat), SMP_CACHE_BYTES); \ }) /* * This definition is just for error path in node hotadd. diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 2a9627dc784c..fc991831d296 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1162,19 +1162,21 @@ static void reset_node_present_pages(pg_data_t *pgd= at) } =20 /* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG = */ -static pg_data_t __ref *hotadd_new_pgdat(int nid) +static pg_data_t __ref *hotadd_init_pgdat(int nid) { struct pglist_data *pgdat; =20 pgdat =3D NODE_DATA(nid); - if (!pgdat) { - pgdat =3D arch_alloc_nodedata(nid); - if (!pgdat) - return NULL; =20 + /* + * 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. + */ + if (pgdat->per_cpu_nodestats =3D=3D &boot_nodestats) { pgdat->per_cpu_nodestats =3D alloc_percpu(struct per_cpu_nodestat); - arch_refresh_nodedata(nid, pgdat); } else { int cpu; /* @@ -1193,8 +1195,6 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid) } } =20 - /* we can use NODE_DATA(nid) from here */ - pgdat->node_id =3D nid; pgdat->node_start_pfn =3D 0; =20 /* init node's zones as empty zones, we don't have any present pages.*/ @@ -1246,7 +1246,7 @@ static int __try_online_node(int nid, bool set_node_o= nline) if (node_online(nid)) return 0; =20 - pgdat =3D hotadd_new_pgdat(nid); + pgdat =3D hotadd_init_pgdat(nid); if (!pgdat) { pr_err("Cannot online node %d due to NULL pgdat\n", nid); ret =3D -ENOMEM; @@ -1445,9 +1445,6 @@ int __ref add_memory_resource(int nid, struct resourc= e *res, mhp_t mhp_flags) =20 return ret; error: - /* rollback pgdat allocation and others */ - if (new_node) - rollback_node_hotadd(nid); if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) memblock_remove(start, size); error_mem_hotplug_end: diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 3589febc6d31..1a05669044d3 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6402,7 +6402,11 @@ static void __build_all_zonelists(void *data) if (self && !node_online(self->node_id)) { build_zonelists(self); } else { - for_each_online_node(nid) { + /* + * All possible nodes have pgdat preallocated + * free_area_init + */ + for_each_node(nid) { pg_data_t *pgdat =3D NODE_DATA(nid); =20 build_zonelists(pgdat); @@ -8096,8 +8100,32 @@ void __init free_area_init(unsigned long *max_zone_p= fn) /* Initialise every node */ mminit_verify_pageflags_layout(); setup_nr_node_ids(); - for_each_online_node(nid) { - pg_data_t *pgdat =3D NODE_DATA(nid); + for_each_node(nid) { + pg_data_t *pgdat; + + if (!node_online(nid)) { + pr_warn("Node %d uninitialized by the platform. Please report with boot= dmesg.\n", nid); + + /* Allocator not initialized yet */ + pgdat =3D arch_alloc_nodedata(nid); + if (!pgdat) { + pr_err("Cannot allocate %zuB for node %d.\n", + sizeof(*pgdat), nid); + continue; + } + arch_refresh_nodedata(nid, pgdat); + free_area_init_memoryless_node(nid); + /* + * not marking this node online because we do not want to + * confuse userspace by sysfs files/directories for node + * without any memory attached to it (see topology_init) + * The pgdat will get fully initialized when a memory is + * hotpluged into it by hotadd_init_pgdat + */ + continue; + } + + pgdat =3D NODE_DATA(nid); free_area_init_node(nid); =20 /* Any memory on that node */ --=20 2.30.2 From nobody Tue Jun 30 02:38:54 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4E2EC433F5 for ; Thu, 27 Jan 2022 08:53:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237961AbiA0Ix1 (ORCPT ); Thu, 27 Jan 2022 03:53:27 -0500 Received: from mail-ej1-f53.google.com ([209.85.218.53]:37452 "EHLO mail-ej1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237938AbiA0IxT (ORCPT ); Thu, 27 Jan 2022 03:53:19 -0500 Received: by mail-ej1-f53.google.com with SMTP id ah7so4256318ejc.4 for ; Thu, 27 Jan 2022 00:53:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3cffNYGj+Akz41OJV9J6tS+Lh80OSf1RghBDqxOpAp4=; b=OGINEwD/6ua8UD6gA6MViLWOTs+4S9Newhhgq25pKwlsQYfYqtSV8n0pBOIsPY9+Jh +7gx4ELnDv9+0yiOYv9p9kHgbK2unz4FxjJoP6beF/HjWP0zLbC5QQYfeKkMJKa+5DoX v+ZAhp03mMzw9Qk9puIhSWpFzpV6qIzvO+hSEY+t8d4YPFkApD5NvqKiaORKImAxGtNt Tn7G7kxkDPxD5QnIq0tcJMyAsy1etYBUGnAulTNBx9txa2VkAt36A29xCAgd9GUE2pHI eli8u0IBQCuB2H9HLecxIrYthVR78XX2NbV1Ez/DskHaRDw0tAcfL/lbblpLRlz72IIB CfJQ== X-Gm-Message-State: AOAM530+D1CvwwQlSidTByNUjompZTz1vk8OLrt6/3kbe9GSn93FbmT4 n1dmWTfNTz/agpuq/LRUyfs= X-Google-Smtp-Source: ABdhPJxrVaAhLyFhkkAgJvzZzpNdN996I46c3cMfR4IVIdNKkjTkr/h5oXzh9WZRYAUcKqeCQtAmhg== X-Received: by 2002:a17:906:8412:: with SMTP id n18mr2096772ejx.483.1643273597838; Thu, 27 Jan 2022 00:53:17 -0800 (PST) Received: from localhost.localdomain (ip-85-160-47-31.eurotel.cz. [85.160.47.31]) by smtp.gmail.com with ESMTPSA id n11sm11029757edv.52.2022.01.27.00.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 00:53:17 -0800 (PST) From: Michal Hocko To: Andrew Morton Cc: , LKML , David Hildenbrand , Alexey Makhalov , Dennis Zhou , Eric Dumazet , Oscar Salvador , Tejun Heo , Christoph Lameter , Nico Pache , Wei Yang , Rafael Aquini , Michal Hocko Subject: [PATCH 3/6] mm, memory_hotplug: drop arch_free_nodedata Date: Thu, 27 Jan 2022 09:53:02 +0100 Message-Id: <20220127085305.20890-4-mhocko@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220127085305.20890-1-mhocko@kernel.org> References: <20220127085305.20890-1-mhocko@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Hocko Prior to "mm: handle uninitialized numa nodes gracefully" memory hotplug used to allocate pgdat when memory has been added to a node (hotadd_init_pgdat) arch_free_nodedata has been only used in the failure path because once the pgdat is exported (to be visible by NODA_DATA(nid)) it cannot really be freed because there is no synchronization available for that. pgdat is allocated for each possible nodes now so the memory hotplug doesn't need to do the ever use arch_free_nodedata so drop it. This patch doesn't introduce any functional change. Acked-by: Rafael Aquini Signed-off-by: Michal Hocko --- arch/ia64/mm/discontig.c | 5 ----- include/linux/memory_hotplug.h | 3 --- mm/memory_hotplug.c | 10 ---------- 3 files changed, 18 deletions(-) diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c index dd0cf4834eaa..73d0db36edb6 100644 --- a/arch/ia64/mm/discontig.c +++ b/arch/ia64/mm/discontig.c @@ -615,11 +615,6 @@ pg_data_t * __init arch_alloc_nodedata(int nid) return memblock_alloc(size, SMP_CACHE_BYTES); } =20 -void arch_free_nodedata(pg_data_t *pgdat) -{ - kfree(pgdat); -} - void arch_refresh_nodedata(int update_node, pg_data_t *update_pgdat) { pgdat_list[update_node] =3D update_pgdat; diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index cdd66bfdf855..60f09d3ebb3d 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -24,17 +24,14 @@ struct vmem_altmap; * node_data[nid] =3D kzalloc() works well. But it depends on the architec= ture. * * In general, generic_alloc_nodedata() is used. - * Now, arch_free_nodedata() is just defined for error path of node_hot_ad= d. * */ extern pg_data_t *arch_alloc_nodedata(int nid); -extern void arch_free_nodedata(pg_data_t *pgdat); extern void arch_refresh_nodedata(int nid, pg_data_t *pgdat); =20 #else /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ =20 #define arch_alloc_nodedata(nid) generic_alloc_nodedata(nid) -#define arch_free_nodedata(pgdat) generic_free_nodedata(pgdat) =20 #ifdef CONFIG_NUMA /* diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index fc991831d296..875cdc7ffa58 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1217,16 +1217,6 @@ static pg_data_t __ref *hotadd_init_pgdat(int nid) return pgdat; } =20 -static void rollback_node_hotadd(int nid) -{ - pg_data_t *pgdat =3D NODE_DATA(nid); - - arch_refresh_nodedata(nid, NULL); - free_percpu(pgdat->per_cpu_nodestats); - arch_free_nodedata(pgdat); -} - - /* * __try_online_node - online a node if offlined * @nid: the node ID --=20 2.30.2 From nobody Tue Jun 30 02:38:54 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A628C433EF for ; Thu, 27 Jan 2022 08:53:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237938AbiA0Ixa (ORCPT ); Thu, 27 Jan 2022 03:53:30 -0500 Received: from mail-ed1-f49.google.com ([209.85.208.49]:40747 "EHLO mail-ed1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237943AbiA0IxU (ORCPT ); Thu, 27 Jan 2022 03:53:20 -0500 Received: by mail-ed1-f49.google.com with SMTP id w25so1795880edt.7 for ; Thu, 27 Jan 2022 00:53:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o2zfZ9y8ubmSsgs0imIlAZWCHpb/2emUUUVSrMtiaz8=; b=FilsinnH5AaHP3VrnfjB4T1dkHi7XVw2dVk7T9XDMmjlVpSifx5LMYykN7c8EuZ+7z m62rdmVWRfGCmSc1m+334WkByTlyDFOlEyhhhPVN2heSzlpwSEbE1jg9W7rX+LsR1nwJ +DvHm9Dl8QMPAYl38cg6NrT9Tr2X6TuTdNb9o5wth0nmqXbxR5m5BL07TFOo4zperxpv JSeySWvzba85yWELk0S9D44sxitwtEtL6K2/Zs+hXYauyrdZ6/UvTjH4FKTRYj65P/i0 tkgp2U7toKBcE/xI4ep1qg526wPTEUbRVNfedZ0CzL3rL6jylrHSwOFz0bryuFuXssD/ lXzA== X-Gm-Message-State: AOAM5330L4WJD1vkXhKzOyOZDo9Dx+9QtrSVEzrbA0T6n9iawEecsY7X CuqE3uMkqW6ktVnnmaVBy40= X-Google-Smtp-Source: ABdhPJwqBhWAjvbeH+BW4ztneuZOZmY0mmUJv1AptsP99+eWvmD466zGqb52l7t35QkusOe+F+8KHQ== X-Received: by 2002:a05:6402:2750:: with SMTP id z16mr2734834edd.312.1643273599208; Thu, 27 Jan 2022 00:53:19 -0800 (PST) Received: from localhost.localdomain (ip-85-160-47-31.eurotel.cz. [85.160.47.31]) by smtp.gmail.com with ESMTPSA id n11sm11029757edv.52.2022.01.27.00.53.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 00:53:18 -0800 (PST) From: Michal Hocko To: Andrew Morton Cc: , LKML , David Hildenbrand , Alexey Makhalov , Dennis Zhou , Eric Dumazet , Oscar Salvador , Tejun Heo , Christoph Lameter , Nico Pache , Wei Yang , Rafael Aquini , Michal Hocko Subject: [PATCH 4/6] mm, memory_hotplug: reorganize new pgdat initialization Date: Thu, 27 Jan 2022 09:53:03 +0100 Message-Id: <20220127085305.20890-5-mhocko@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220127085305.20890-1-mhocko@kernel.org> References: <20220127085305.20890-1-mhocko@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Hocko When a !node_online node is brought up it needs a hotplug specific initialization because the node could be either uninitialized yet or it could have been recycled after previous hotremove. hotadd_init_pgdat is responsible for that. Internal pgdat state is initialized at two places currently - hotadd_init_pgdat - free_area_init_core_hotplug There is no real clear cut what should go where but this patch's chosen to move the whole internal state initialization into free_area_init_core_hotpl= ug. hotadd_init_pgdat is still responsible to pull all the parts together - most notably to initialize zonelists because those depend on the overall to= pology. This patch doesn't introduce any functional change. Acked-by: Rafael Aquini Signed-off-by: Michal Hocko --- include/linux/memory_hotplug.h | 2 +- mm/memory_hotplug.c | 28 +++------------------------- mm/page_alloc.c | 25 +++++++++++++++++++++++-- 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 60f09d3ebb3d..76bf2de86def 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); =20 #ifdef CONFIG_MEMORY_HOTPLUG -extern void __ref free_area_init_core_hotplug(int nid); +extern void __ref free_area_init_core_hotplug(struct pglist_data *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 875cdc7ffa58..ddc62f8b591f 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1166,39 +1166,16 @@ static pg_data_t __ref *hotadd_init_pgdat(int nid) { struct pglist_data *pgdat; =20 - pgdat =3D 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. */ - if (pgdat->per_cpu_nodestats =3D=3D &boot_nodestats) { - pgdat->per_cpu_nodestats =3D - alloc_percpu(struct per_cpu_nodestat); - } else { - int cpu; - /* - * 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 =3D 0; - pgdat->kswapd_order =3D 0; - pgdat->kswapd_highest_zoneidx =3D 0; - for_each_online_cpu(cpu) { - struct per_cpu_nodestat *p; - - p =3D per_cpu_ptr(pgdat->per_cpu_nodestats, cpu); - memset(p, 0, sizeof(*p)); - } - } - - pgdat->node_start_pfn =3D 0; + pgdat =3D NODE_DATA(nid); =20 /* init node's zones as empty zones, we don't have any present pages.*/ - free_area_init_core_hotplug(nid); + free_area_init_core_hotplug(pgdat); =20 /* * The node we allocated has no zone fallback lists. For avoiding @@ -1210,6 +1187,7 @@ static pg_data_t __ref *hotadd_init_pgdat(int nid) * 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); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1a05669044d3..32d0189de4c5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7506,12 +7506,33 @@ static void __meminit zone_init_internals(struct zo= ne *zone, enum zone_type idx, * NOTE: this function is only called during memory hotplug */ #ifdef CONFIG_MEMORY_HOTPLUG -void __ref free_area_init_core_hotplug(int nid) +void __ref free_area_init_core_hotplug(struct pglist_data *pgdat) { + int nid =3D pgdat->node_id; enum zone_type z; - pg_data_t *pgdat =3D NODE_DATA(nid); + int cpu; =20 pgdat_init_internals(pgdat); + + if (pgdat->per_cpu_nodestats =3D=3D &boot_nodestats) + pgdat->per_cpu_nodestats =3D 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 =3D 0; + pgdat->kswapd_order =3D 0; + pgdat->kswapd_highest_zoneidx =3D 0; + pgdat->node_start_pfn =3D 0; + for_each_online_cpu(cpu) { + struct per_cpu_nodestat *p; + + p =3D per_cpu_ptr(pgdat->per_cpu_nodestats, cpu); + memset(p, 0, sizeof(*p)); + } + for (z =3D 0; z < MAX_NR_ZONES; z++) zone_init_internals(&pgdat->node_zones[z], z, nid, 0); } --=20 2.30.2 From nobody Tue Jun 30 02:38:54 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 059D1C433EF for ; Thu, 27 Jan 2022 08:53:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238025AbiA0Ixd (ORCPT ); Thu, 27 Jan 2022 03:53:33 -0500 Received: from mail-ej1-f51.google.com ([209.85.218.51]:45664 "EHLO mail-ej1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237956AbiA0IxW (ORCPT ); Thu, 27 Jan 2022 03:53:22 -0500 Received: by mail-ej1-f51.google.com with SMTP id me13so4109894ejb.12 for ; Thu, 27 Jan 2022 00:53:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XTSCSWPE5HlRFNZCvz3I8p5LYXgsNZWlsLbybuNzyTQ=; b=FSOW0c2P5ofKKFZsLwUQdfXsC3YuIHGSW2LK3Kec4bKBcqlFllDOOTa2HooiGKYdIU aUiTrRS1XA2SuSnpX1MO/ZYRs8CsrKFBf3k7/a8gvtUFlaQQ5O7pVApG44ZQso1rvzUX W8RNJMiv8zhROdHaSZSUzSpJCRE4XMALCpByxiNY2AEj0e0mx1v6QvB641nV8uwEPq8s 9MZx2Gk10a3KAgPJTUWtFdT8GONIoWq8Ul8p+veU0KAWrp1UK3yOhP4nKQBGaDNPIrc9 0QkveBPa/OgdK/05C/hWze1r12IexDtE0BQscc1yYJVLIQzgZSnQFMLAc6icwiwJQszi Il9g== X-Gm-Message-State: AOAM5338uWgTeewRZXz7RjAeAHllSv7VFHBTNFYdBZRTq223/SHr9CUa GZZA4fnv5MmXPExIGP450uI= X-Google-Smtp-Source: ABdhPJx5ObyDxjwZXcVYWQ4o7Bymlq1geZKx3vr/oZ+xt0Gwg0+GZ4uac6cBGWutrb83Kkr4i2ecBQ== X-Received: by 2002:a17:907:b01:: with SMTP id h1mr2087725ejl.728.1643273600849; Thu, 27 Jan 2022 00:53:20 -0800 (PST) Received: from localhost.localdomain (ip-85-160-47-31.eurotel.cz. [85.160.47.31]) by smtp.gmail.com with ESMTPSA id n11sm11029757edv.52.2022.01.27.00.53.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 00:53:20 -0800 (PST) From: Michal Hocko To: Andrew Morton Cc: , LKML , David Hildenbrand , Alexey Makhalov , Dennis Zhou , Eric Dumazet , Oscar Salvador , Tejun Heo , Christoph Lameter , Nico Pache , Wei Yang , Rafael Aquini , Michal Hocko Subject: [PATCH 5/6] mm: make free_area_init_node aware of memory less nodes Date: Thu, 27 Jan 2022 09:53:04 +0100 Message-Id: <20220127085305.20890-6-mhocko@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220127085305.20890-1-mhocko@kernel.org> References: <20220127085305.20890-1-mhocko@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Hocko free_area_init_node is also called from memory less node initialization path (free_area_init_memoryless_node). It doesn't really make much sense to display the physical memory range for those nodes: Initmem setup node XX [mem 0x0000000000000000-0x0000000000000000] Instead be explicit that the node is memoryless: Initmem setup node XX as memoryless Acked-by: Rafael Aquini Signed-off-by: Michal Hocko --- mm/page_alloc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 32d0189de4c5..83da2279be72 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7682,9 +7682,14 @@ static void __init free_area_init_node(int nid) pgdat->node_start_pfn =3D start_pfn; pgdat->per_cpu_nodestats =3D NULL; =20 - 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); + if (start_pfn !=3D end_pfn) { + 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); + } else { + pr_info("Initmem setup node %d as memoryless\n", nid); + } + calculate_node_totalpages(pgdat, start_pfn, end_pfn); =20 alloc_node_mem_map(pgdat); --=20 2.30.2 From nobody Tue Jun 30 02:38:54 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F7BBC433EF for ; Thu, 27 Jan 2022 08:53:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238052AbiA0Ixe (ORCPT ); Thu, 27 Jan 2022 03:53:34 -0500 Received: from mail-ej1-f53.google.com ([209.85.218.53]:39776 "EHLO mail-ej1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237928AbiA0IxX (ORCPT ); Thu, 27 Jan 2022 03:53:23 -0500 Received: by mail-ej1-f53.google.com with SMTP id j2so4226764ejk.6 for ; Thu, 27 Jan 2022 00:53:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Yw/+DDZVAI1kM3jl62EkxWAhTt9qU97/TTaQLgANFqA=; b=FG1WbX44Jryj/pMeYJJtXJwuqIdIP3w2zHxf+WniEGuaw+1fNq8M1s7tUW2wexKHNK ivU/VXetxxd11KP7yzBd+RYGN6fDj09vMXswget/3G6GeyqbPbAI/5TpEwnjZ3MGLR5o DSNbTkPdVHvHNdFnTY/R12UtqfcuvNmmjji1mUUFTN6I8Yth4u8O2/qARrbojz1eE0ws Iho2kEpeXBiNjmxrZgsLo1fWh920SSZyfQTrKLQJ7tp5gNILqVUJAkgRPZ9JPKMz9Req kIusB7jWJO1Nsl+UHggJugcwkgaKbuZhX1T7yxpYOAhzPVuuxj+4oCMO5/6EHDcKXjQC RVIw== X-Gm-Message-State: AOAM530sZ1u+WWAoIvn4L5EjXzTgO5D+qoXvetQj7jPevbMOKMEFSq2e odghPgYYR/r8d4QQG9GEhxnU8/a9S0k= X-Google-Smtp-Source: ABdhPJxR/nkchzrmyjQR0DAh0Fch7YdSctIIC56sUAj9QFTJaDNlIHcSch+FL75+Y65K4z2NQOAw8g== X-Received: by 2002:a17:907:94d5:: with SMTP id dn21mr2232871ejc.77.1643273602447; Thu, 27 Jan 2022 00:53:22 -0800 (PST) Received: from localhost.localdomain (ip-85-160-47-31.eurotel.cz. [85.160.47.31]) by smtp.gmail.com with ESMTPSA id n11sm11029757edv.52.2022.01.27.00.53.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 00:53:21 -0800 (PST) From: Michal Hocko To: Andrew Morton Cc: , LKML , David Hildenbrand , Alexey Makhalov , Dennis Zhou , Eric Dumazet , Oscar Salvador , Tejun Heo , Christoph Lameter , Nico Pache , Wei Yang , Rafael Aquini , Michal Hocko Subject: [PATCH 6/6] memcg: do not tweak node in alloc_mem_cgroup_per_node_info Date: Thu, 27 Jan 2022 09:53:05 +0100 Message-Id: <20220127085305.20890-7-mhocko@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220127085305.20890-1-mhocko@kernel.org> References: <20220127085305.20890-1-mhocko@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wei Yang alloc_mem_cgroup_per_node_info is allocated for each possible node and this used to be a problem because not !node_online nodes didn't have appropriate data structure allocated. This has changed by "mm: handle uninitialized numa nodes gracefully" so we can drop the special casing here. Signed-off-by: Wei Yang Signed-off-by: Michal Hocko --- mm/memcontrol.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 09d342c7cbd0..8b3f9eef4c65 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5067,18 +5067,8 @@ struct mem_cgroup *mem_cgroup_from_id(unsigned short= id) static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int no= de) { struct mem_cgroup_per_node *pn; - int tmp =3D node; - /* - * This routine is called against possible nodes. - * But it's BUG to call kmalloc() against offline node. - * - * TODO: this routine can waste much memory for nodes which will - * never be onlined. It's better to use memory hotplug callback - * function. - */ - if (!node_state(node, N_NORMAL_MEMORY)) - tmp =3D -1; - pn =3D kzalloc_node(sizeof(*pn), GFP_KERNEL, tmp); + + pn =3D kzalloc_node(sizeof(*pn), GFP_KERNEL, node); if (!pn) return 1; =20 --=20 2.30.2