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 741A7C433EF for ; Tue, 7 Dec 2021 12:28:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C7B196B008C; Tue, 7 Dec 2021 07:28:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C2B926B0096; Tue, 7 Dec 2021 07:28:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF2D96B00A2; Tue, 7 Dec 2021 07:28:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id 9C9D06B008C for ; Tue, 7 Dec 2021 07:28:46 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4D2DA8249980 for ; Tue, 7 Dec 2021 12:28:36 +0000 (UTC) X-FDA: 78890926632.24.0F085CE Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf17.hostedemail.com (Postfix) with ESMTP id 91458F0001CD for ; Tue, 7 Dec 2021 12:28:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638880115; 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=cagfr5xiejTCKvKcT1eoE8t5fFgtJiRBP779AAta8HP7tHNcCKFrSs3JIAroAfpjnEj+EG Ksr+hTHPitgaTwzAgI43IrtejUBSIsjta87a4cKUZIyjmpwgH8s77qfmM8wQEKMcGiX3U5 KM/oUYcwMq3aOkEZz0mzONGg7sKiI9U= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-202-SOqA-lC_OHirYwfMWPeRgg-1; Tue, 07 Dec 2021 07:28:34 -0500 X-MC-Unique: SOqA-lC_OHirYwfMWPeRgg-1 Received: by mail-wm1-f70.google.com with SMTP id j193-20020a1c23ca000000b003306ae8bfb7so7652052wmj.7 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=tNTzGG4deLYb6GY6K3j3tz/ZxWw2NZBzDFQ/sU2Xr6NHr1VyCb1C15swIiqugHqlV/ JOglzUJ+SUJ/xqICv8QT9H1NfDqyF3JIaNMdycY5eTgFl1HXqKU691UCI88iucpbNm20 m8Hw4neaTThKSgAtskUNDYeAlCGeQ1keXdRPr5i4i3KQ3XRa+jXnv+Ypay73HmLZ4NLw EWyHoukYgFUnripS4Pq+uKu9dyYFM+8UepoyesVYV5KernUvI2FF0adwnnrHvn+DbJ1F RM6g6Jwc5ABM/Z+XOceA51TlUJb6XWc/LuOi6KLbV1jFngbGB/teen0tREt7gn+oeapk Tjbg== X-Gm-Message-State: AOAM5329hhRWIR/bkZv1qisINRaAc0gtyvNO1ChVjGBymKTELFmRUKFX QWvdtH3qxtgdJLIYWLqSm7jY6nWnhmfYzMLtKmP1PKCN9h1gkrFgWDjNq/pRMgGut0wHmuIJyb/ f9nVmWImQMzM= X-Received: by 2002:a05:600c:1e8b:: with SMTP id be11mr6643922wmb.40.1638880112897; 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 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: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 91458F0001CD X-Stat-Signature: 1egcoh7n6hzuwrbibf6rnfidef18rcdu Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cagfr5xi; spf=none (imf17.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1638880115-27617 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: >>> + 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