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 53788C433F5 for ; Tue, 7 Dec 2021 16:37:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B894D6B00A2; Tue, 7 Dec 2021 11:37:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B38186B00A4; Tue, 7 Dec 2021 11:37:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D9736B00A5; Tue, 7 Dec 2021 11:37:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0074.hostedemail.com [216.40.44.74]) by kanga.kvack.org (Postfix) with ESMTP id 8F6356B00A2 for ; Tue, 7 Dec 2021 11:37:15 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 578B0181327C9 for ; Tue, 7 Dec 2021 16:37:05 +0000 (UTC) X-FDA: 78891552810.18.5B18AEE Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf17.hostedemail.com (Postfix) with ESMTP id A4F64F0001CF for ; Tue, 7 Dec 2021 16:37:04 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 8C67B1FE00; Tue, 7 Dec 2021 16:37:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638895023; 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=t9RUC2PhV3f3vpLr11mqtR46jAj5ypI8WeQwEBxBuSg=; b=nFAtzgaui7XXCSyIUUC0UwS92t88o7kHrBhmYfbaShb0VuaqvjaVvqshjcMYZjZFAiekzn gAYJSC1u5tFGyVtcv44rg12z3kno9uDMQZ4JUqd5e7hAUJbK4tTcMcEfvfX8EiGclUcg/S e75pdfB0GAi2ctXqz6kXWUxR9/t0F9E= 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 51811A3BA5; Tue, 7 Dec 2021 16:37:03 +0000 (UTC) Date: Tue, 7 Dec 2021 17:36:59 +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" Subject: Re: [PATCH v3] mm: fix panic in __alloc_pages Message-ID: References: <1043a1a4-b7f2-8730-d192-7cab9f15ee24@redhat.com> <77e785e6-cf34-0cff-26a5-852d3786a9b8@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: A4F64F0001CF Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=nFAtzgau; spf=pass (imf17.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspamd-Server: rspam04 X-Stat-Signature: ce7twumrkho9rppaz8q46ecb7dtriu17 X-HE-Tag: 1638895024-430630 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 Tue 07-12-21 17:27:29, Michal Hocko wrote: [...] > So your proposal is to drop set_node_online from the patch and add it as > a separate one which handles > - sysfs part (i.e. do not register a node which doesn't span a > physical address space) > - hotplug side of (drop the pgd allocation, register node lazily > when a first memblocks are registered) In other words, the first stage diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c5952749ad40..f9024ba09c53 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6382,7 +6382,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 = NODE_DATA(nid); build_zonelists(pgdat); @@ -8032,8 +8036,24 @@ void __init free_area_init(unsigned long *max_zone_pfn) /* Initialise every node */ mminit_verify_pageflags_layout(); setup_nr_node_ids(); - for_each_online_node(nid) { - pg_data_t *pgdat = 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); + pgdat = arch_alloc_nodedata(nid); + pgdat->per_cpu_nodestats = alloc_percpu(struct per_cpu_nodestat); + 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) + */ + continue; + } + + pgdat = NODE_DATA(nid); free_area_init_node(nid); /* Any memory on that node */ -- Michal Hocko SUSE Labs