From mboxrd@z Thu Jan 1 00:00:00 1970 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 EEB7EC433F5 for ; Tue, 14 Dec 2021 08:38:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 41EA76B0074; Tue, 14 Dec 2021 03:38:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CF3C6B0075; Tue, 14 Dec 2021 03:38:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 296C16B0078; Tue, 14 Dec 2021 03:38:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0164.hostedemail.com [216.40.44.164]) by kanga.kvack.org (Postfix) with ESMTP id 1C97F6B0074 for ; Tue, 14 Dec 2021 03:38:46 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id DA6578249980 for ; Tue, 14 Dec 2021 08:38:35 +0000 (UTC) X-FDA: 78915748590.16.E3551D6 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf06.hostedemail.com (Postfix) with ESMTP id 9B24618000A for ; Tue, 14 Dec 2021 08:38:34 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id E076C1F3C4; Tue, 14 Dec 2021 08:38:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1639471113; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YxBgd60xxvmPh600wNZTY4w7KXnu0mHxHrDaqy+o98A=; b=vVvheb2IkU+9MQvKe8kp/a+f0guikXyJAnX57LL0b9Spp1rmzBXcKVMYv7AC3h/HpFhznH 4wr8dnj3mj449LOYEcW1JhvRrJkjkhCS9WRL0TP5R29ZUhahxJicw5MR8xPg6AqsJNJF9A YPeyptfBpPp3onsg+s/QHeycWIFUXgo= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 97D7DA3B88; Tue, 14 Dec 2021 08:38:33 +0000 (UTC) Date: Tue, 14 Dec 2021 09:38:33 +0100 From: Michal Hocko To: David Hildenbrand Cc: Alexey Makhalov , Dennis Zhou , Eric Dumazet , "linux-mm@kvack.org" , Andrew Morton , Oscar Salvador , Tejun Heo , Christoph Lameter , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , Nico Pache Subject: Re: [PATCH v3] mm: fix panic in __alloc_pages Message-ID: References: <5239D699-523C-4F0C-923A-B068E476043E@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 9B24618000A X-Stat-Signature: mmbo6u8gpkjzyszf8wkm1tx6c9nocf7h Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=vVvheb2I; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf06.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com X-HE-Tag: 1639471114-726656 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: On Mon 13-12-21 16:07:18, David Hildenbrand wrote: > On 13.12.21 16:06, Michal Hocko wrote: > > On Thu 09-12-21 11:48:42, Michal Hocko wrote: > > [...] > >> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > >> index 852041f6be41..2d38a431f62f 100644 > >> --- a/mm/memory_hotplug.c > >> +++ b/mm/memory_hotplug.c > >> @@ -1161,19 +1161,21 @@ 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_new_pgdat(int nid) > >> +static pg_data_t __ref *hotadd_init_pgdat(int nid) > >> { > >> struct pglist_data *pgdat; > >> > >> pgdat = NODE_DATA(nid); > >> - if (!pgdat) { > >> - pgdat = arch_alloc_nodedata(nid); > >> - if (!pgdat) > >> - return NULL; > >> > >> + /* > >> + * 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) { > >> pgdat->per_cpu_nodestats = > >> alloc_percpu(struct per_cpu_nodestat); > >> - arch_refresh_nodedata(nid, pgdat); > > > > This should really be > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > > index 42211485bcf3..2daa88ce8c80 100644 > > --- a/mm/memory_hotplug.c > > +++ b/mm/memory_hotplug.c > > @@ -1173,7 +1173,7 @@ static pg_data_t __ref *hotadd_init_pgdat(int nid) > > * Completely offline nodes stay around and they just need > > * reintialization. > > */ > > - if (!pgdat->per_cpu_nodestats) { > > + if (pgdat->per_cpu_nodestats == &boot_nodestats) { > > pgdat->per_cpu_nodestats = > > alloc_percpu(struct per_cpu_nodestat); > > } else { > > > > I'll try giving this some churn later this week -- busy with other stuff. Please hang on, this needs to be done yet slightly differently. I will post something more resembling a final patch later today. For the purpose of the testing this should be sufficient for now. -- Michal Hocko SUSE Labs