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 00FF1C433F5 for ; Tue, 7 Dec 2021 16:40:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237905AbhLGQoN (ORCPT ); Tue, 7 Dec 2021 11:44:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:21300 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235031AbhLGQoL (ORCPT ); Tue, 7 Dec 2021 11:44:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638895241; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4KoT7MoJZdMHzhKqbC4j9Azc/TQJ3pztEdVibRZgna0=; b=gOOjVpVpeSWVsMrCnkj409XOLFpqoh/zJ9H5y7JNNYWEEuC2niDlSlJ9pexs6Xa6cRfgu5 jcxeIz80pMhS38xywc0N27M5lp6MbI/OjrDnB5/zdW3KCnm5zVmim6Sjc26ebZX1/O2Q5v N0H+U9aVM9chrqKxQPmYnxpORRGBllI= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-392-2K5pZnF7P9-5hiWDPjbAAQ-1; Tue, 07 Dec 2021 11:40:40 -0500 X-MC-Unique: 2K5pZnF7P9-5hiWDPjbAAQ-1 Received: by mail-wm1-f72.google.com with SMTP id p12-20020a05600c1d8c00b0033a22e48203so1621191wms.6 for ; Tue, 07 Dec 2021 08:40:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=4KoT7MoJZdMHzhKqbC4j9Azc/TQJ3pztEdVibRZgna0=; b=UXSsYX7/NME7U5upa5nEngtAqztV4lB8xAp/NOax8/WDlEtdf3CfpYaFa+U+lS6y2U n4t652NdED4qh2O76z7nzdFNFsdyiEAxF5tmiZRyXusHWzxbTfN5FCpNPfx9I76UTL5T NF2OCE/Ms0G/ffW1Gk14FNkbXsQKpwX08xYzmMJQlXmdDF0NW5xcQJLZ/oPHEF16Brb3 NB35/EvjOMmiA4ULR9iqN0plC8vsyR7q8yvoZjbRCPLooy+fmnQQWF5QUdO6/MSq2OyM pYkEZ+LnobTJ4a7wSd1xS3dl2lDMeOc/WzHkyaVks6N6n9tcO52zn9j18roDAjyJAstk x35g== X-Gm-Message-State: AOAM531AChop49k+/IBCoirW1nP/E/0wUueHgvPWHaraLRZI/yoYNP5n xgEFnA7CF+UJtOzj7igkong+yLi3Lyc4JLBUJnSsgYJlDWjnd79rYPwTXNARHxpePSuMgxWz1i5 YUgnxpr3yCc5y9KHC8Tuxe2Uq X-Received: by 2002:a05:600c:4f48:: with SMTP id m8mr8470689wmq.50.1638895237679; Tue, 07 Dec 2021 08:40:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLRGhMk0hwoWx4NOrHSo4XAoQnohJI6lQltoXOlkpwvXm6WNomi9AzfV9scYz1A7y1asfVmg== X-Received: by 2002:a05:600c:4f48:: with SMTP id m8mr8470651wmq.50.1638895237427; Tue, 07 Dec 2021 08:40:37 -0800 (PST) Received: from [192.168.3.132] (p4ff23e57.dip0.t-ipconnect.de. [79.242.62.87]) by smtp.gmail.com with ESMTPSA id k13sm211285wri.6.2021.12.07.08.40.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Dec 2021 08:40:37 -0800 (PST) Message-ID: <235e8656-a947-b446-c39c-fa0f72b65ac7@redhat.com> Date: Tue, 7 Dec 2021 17:40:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v3] mm: fix panic in __alloc_pages Content-Language: en-US To: Michal Hocko 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" References: <1043a1a4-b7f2-8730-d192-7cab9f15ee24@redhat.com> <77e785e6-cf34-0cff-26a5-852d3786a9b8@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07.12.21 17:36, Michal Hocko wrote: > 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); Is the buddy fully up an running at that point? I don't think so, so we might have to allocate via memblock instead. But I might be wrong. > + 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 */ > Yes, and maybe in the same go, remove/rework hotadd_new_pgdat(), because there is nothing to hotadd anymore. (we should double-check the initialization performed in there, it might all not be necessary anymore) -- Thanks, David / dhildenb