From patchwork Wed May 29 17:12:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13679308 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CDC94C25B75 for ; Wed, 29 May 2024 17:14:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CTZRgcvaVYz9IRLDx0N6WDVRR909c7Ce2SWwwomeKTU=; b=GkKwoISK8127Jv h2SFqMl9+cE8hkZplN6CTiWzXBSfKLimx8xh7d3AHPa2OgElZF5aLXN+DjVADQoPt4ldQIWKt1QSE rhN5KVsIJ1MEDpvG5mtMl/h9oZ6+haaNzSLzooT6TVRz2heG4BKSQ4ll5p8aDcao4BD1MpLYkadIS PRqTZfHjNfaiIraj9y9ZGAFqIrmJ8otEi2SDUH4km7ECVwEKyE5LTnUYxljejooawmKO16GkHtYIk l7rUto/27pcRxJec4DvPOO2T30yLAWRB8TRJ7/iSCo2WdSU8y3DSRYLR5Ek8Dc9IqYbtjs0neIKJt 48jmvzKwZ3nnKnp8F8Gw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCMsv-000000052AI-0Hko; Wed, 29 May 2024 17:14:45 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCMsr-0000000529O-2EWV for linux-arm-kernel@lists.infradead.org; Wed, 29 May 2024 17:14:43 +0000 Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VqGDy5XCQz6K95K; Thu, 30 May 2024 01:13:38 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id B3F3E140B33; Thu, 30 May 2024 01:14:39 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 29 May 2024 18:14:39 +0100 From: Jonathan Cameron To: Dan Williams , , , Sudeep Holla CC: Andrew Morton , David Hildenbrand , Will Deacon , Jia He , Mike Rapoport , , , , Yuquan Wang , Oscar Salvador , Lorenzo Pieralisi , James Morse Subject: [RFC PATCH 4/8] arch_numa: Avoid onlining empty NUMA nodes Date: Wed, 29 May 2024 18:12:32 +0100 Message-ID: <20240529171236.32002-5-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240529171236.32002-1-Jonathan.Cameron@huawei.com> References: <20240529171236.32002-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml500001.china.huawei.com (7.191.163.213) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240529_101441_878383_93ECA780 X-CRM114-Status: GOOD ( 10.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org ACPI can declare NUMA nodes for memory that will be along later. CXL Fixed Memory Windows may also be assigned NUMA nodes that are initially empty. Currently the generic arch_numa handling will online these empty nodes. This is both inconsistent with x86 and with itself as if we add memory and remove it again the node goes away. Signed-off-by: Jonathan Cameron --- drivers/base/arch_numa.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c index 5b59d133b6af..0630efb696ab 100644 --- a/drivers/base/arch_numa.c +++ b/drivers/base/arch_numa.c @@ -363,6 +363,11 @@ static int __init numa_register_nodes(void) unsigned long start_pfn, end_pfn; get_pfn_range_for_nid(nid, &start_pfn, &end_pfn); + if (start_pfn >= end_pfn && + !node_state(nid, N_CPU) && + !node_state(nid, N_GENERIC_INITIATOR)) + continue; + setup_node_data(nid, start_pfn, end_pfn); node_set_online(nid); }