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 4E4E9C433F5 for ; Tue, 7 Dec 2021 13:23:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 628096B0082; Tue, 7 Dec 2021 08:23:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D64F6B0083; Tue, 7 Dec 2021 08:23:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4EC816B0085; Tue, 7 Dec 2021 08:23:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0139.hostedemail.com [216.40.44.139]) by kanga.kvack.org (Postfix) with ESMTP id 3BAE36B0082 for ; Tue, 7 Dec 2021 08:23:18 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E8BBF8995F for ; Tue, 7 Dec 2021 13:23:07 +0000 (UTC) X-FDA: 78891064014.05.1F56183 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf15.hostedemail.com (Postfix) with ESMTP id 7C11DD00009A for ; Tue, 7 Dec 2021 13:23:07 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 3195D1FDFE; Tue, 7 Dec 2021 13:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638883386; 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=e3MujDroQCCYFmjo9aU+XnlNtxQIfbbwBM+qx0TwvZA=; b=seX7fjd3dhWbMLAzyyjOOcYy5pvqRFbfqgSB8dF+6CqlVqD6PH5s5EPABaOLYypyFdDlJ9 ywbxRdq9qIuAaZnxc9VBTcZ1jf6GJS/JF1CmOOvwPZ5ZO1w616j2VQ+VTZqWpBh0WlC5vu awim2Bn8l5QAUyuNH6vWNtBeerc21GI= 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 040D8A3B89; Tue, 7 Dec 2021 13:23:05 +0000 (UTC) Date: Tue, 7 Dec 2021 14:23:03 +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: <5239D699-523C-4F0C-923A-B068E476043E@vmware.com> <1043a1a4-b7f2-8730-d192-7cab9f15ee24@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 7C11DD00009A X-Stat-Signature: dpnwse5mqwgd6888oc9jtjq33uyzpxwa Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=seX7fjd3; spf=pass (imf15.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-HE-Tag: 1638883387-501763 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 13:28:31, David Hildenbrand wrote: [...] > But maybe I am missing something important regarding online vs. offline > nodes that your patch changes? I am relying on alloc_node_data setting the node online. But if we are to change the call to arch_alloc_node_data then the patch needs to be more involved. Here is what I have right now. If this happens to be the right way then there is some additional work to sync up with the hotplug code. diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c5952749ad40..a296e934ad2f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -8032,8 +8032,23 @@ 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 memory map.\n", nid); + pgdat = arch_alloc_nodedata(nid); + pgdat->per_cpu_nodestats = alloc_percpu(struct per_cpu_nodestat); + arch_refresh_nodedata(nid, pgdat); + node_set_online(nid); + /* TODO do we need register_one_node here or postpone to + * when any memory is onlined there + */ + free_area_init_memoryless_node(nid); + continue; + } + + pgdat = NODE_DATA(nid); free_area_init_node(nid); /* Any memory on that node */ -- Michal Hocko SUSE Labs