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 96B7CC433EF for ; Tue, 7 Dec 2021 12:28:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236429AbhLGMcG (ORCPT ); Tue, 7 Dec 2021 07:32:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:36445 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231129AbhLGMcF (ORCPT ); Tue, 7 Dec 2021 07:32:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638880114; 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=U86KNIlXWBU0MTv/F9LU3y5IqrvBGqYEtNBS3ySXeBs=; b=h/E2qCa4icdmqIP3AUeH5KMjEZP/s6HYjIIjasrRplvifyQZA6ON/cRY0BErFJbxvPYEf2 4O5tgMCuaRhNcQ/IqfxCy/zX5Jldu5q3cikThwZ//sU3A8LVDvUKCHD8FOUOKeWJHSzJti /w9CgeRRKDXvCG6W5xCTIfCtVxi89JY= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-559-FiqqxuSfNZ6-Drpd0YS2kA-1; Tue, 07 Dec 2021 07:28:34 -0500 X-MC-Unique: FiqqxuSfNZ6-Drpd0YS2kA-1 Received: by mail-wm1-f71.google.com with SMTP id l4-20020a05600c1d0400b00332f47a0fa3so1280801wms.8 for ; Tue, 07 Dec 2021 04:28:33 -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 :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=U86KNIlXWBU0MTv/F9LU3y5IqrvBGqYEtNBS3ySXeBs=; b=I7qHXY7THFU1isxgumCMezke7rOdQA6zavXcRdA8GdV41YsosemkDHQfupA1QWxYxE Ggo9CyuzzCP00vAaxTwHcvBAtQpbOxMoHKyp9iGv5hQ26s6jgkvS2s99C3G5NMBLqZmK qLKmf0MEKavonbJVwNjuGwLGPNZYtiSlDDFUsYY+dl6NuS2OwciQI8YeHDJ8fPvfnxg3 W96cJTdLRJyYn9mRTv2VQ4jc3kj2p0rdGsRADRcJPWcMzAtNrICNxU+SPNY6ijzkBvJj vJsSc6nIJJPBmUQbE9e1J/2sLrUNpA3vZSRTPsBG8KbCk/dyLlKnMgPcR/BehLVgbq5R uj1Q== X-Gm-Message-State: AOAM533GKqJoaaAqv70GBpz35427dhYGVS+8WTeALHHZIAWXDHWkqKSE Zqt5iygWt0j4SzkMLsTO/KV/iXI4ivPjfAniVo98hPXtQaXqCr4D4+6Fr5SL3ThiyA7nz8Dxd+M zDhnR6LeNJtNvYYRLlSeti0aQ X-Received: by 2002:a05:600c:1e8b:: with SMTP id be11mr6643917wmb.40.1638880112896; Tue, 07 Dec 2021 04:28:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyueHJH/VSBXoMRrxMAPOq/Sw7KkduJI/w9KW7Jk8hxAx8dqCJ+QrFIwPfr2gfiIEu/otuukA== X-Received: by 2002:a05:600c:1e8b:: with SMTP id be11mr6643882wmb.40.1638880112674; Tue, 07 Dec 2021 04:28:32 -0800 (PST) Received: from [192.168.3.132] (p4ff23e57.dip0.t-ipconnect.de. [79.242.62.87]) by smtp.gmail.com with ESMTPSA id o25sm2537500wms.17.2021.12.07.04.28.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Dec 2021 04:28:32 -0800 (PST) Message-ID: Date: Tue, 7 Dec 2021 13:28:31 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 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: <2e191db3-286f-90c6-bf96-3f89891e9926@gmail.com> <5239D699-523C-4F0C-923A-B068E476043E@vmware.com> <1043a1a4-b7f2-8730-d192-7cab9f15ee24@redhat.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v3] mm: fix panic in __alloc_pages 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 >>> + free_area_init_memoryless_node(nid); >> >> That's really just free_area_init_node() below, I do wonder what value >> free_area_init_memoryless_node() has as of today. > > I am not sure there is any real value in having this special name for > this but I have kept is sync with what x86 does currently. If we want to > remove the wrapper then just do it everywhere. I can do that on top. > Sure, just a general comment. >>> + continue; >>> + } >>> + >>> free_area_init_node(nid); >>> >>> /* Any memory on that node */ >>> >>> Could you give it a try? I do not have any machine which would exhibit >>> the problem so I cannot really test this out. I hope build_zone_info >>> will not choke on this. I assume the node distance table is >>> uninitialized for these nodes and IIUC this should lead to an assumption >>> that all other nodes are close. But who knows that can blow up there. >>> >>> Btw. does this make any sense at all to others? >>> >> >> __build_all_zonelists() has to update the zonelists of all nodes I think. > > I am not sure what you mean. This should be achieved by this patch > because the boot time build_all_zonelists will go over all online nodes "Over all possible nodes", including online and offline ones, to make sure any possible node has a valid pgdat. IIUC, you're not changing anything about online vs offline nodes, only that we have a pgdat also for offline nodes. > (i.e. with pgdat). free_area_init happens before that. I am just worried > that the arch specific node_distance() will generate a complete garbage > or blow up for some reason. Assume you online a new zone and then call __build_all_zonelists() to include the zone in all zonelists (via online_pages()). __build_all_zonelists() will not include offline nodes (that still have a pgdat with a valid zonelist now). Similarly, assume you online a zone and then call __build_all_zonelists() to exclude the zone from all zonelists (via offline_pages()). __build_all_zonelists() will not include offline nodes (that still have a pgdat with a valid zonelist now). Essentially, IIRC, even after your change start_kernel()->build_all_zonelists(NULL)->build_all_zonelists_init()->__build_all_zonelists(NULL) won't initialize the zonelist of the new pgdat, because the nodes are offline. I'd assume we'd need diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c5952749ad40..e5d958abc7cc 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6382,7 +6382,7 @@ static void __build_all_zonelists(void *data) if (self && !node_online(self->node_id)) { build_zonelists(self); } else { - for_each_online_node(nid) { + for_each_node(nid) { pg_data_t *pgdat = NODE_DATA(nid); build_zonelists(pgdat); to properly initialize the zonelist also for the offline nodes with a valid pgdat. But maybe I am missing something important regarding online vs. offline nodes that your patch changes? -- Thanks, David / dhildenb