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 D07AAC3DA64 for ; Thu, 1 Aug 2024 17:44:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5374B6B0083; Thu, 1 Aug 2024 13:44:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E70C6B0085; Thu, 1 Aug 2024 13:44:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3AE296B0088; Thu, 1 Aug 2024 13:44:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 1DBD86B0083 for ; Thu, 1 Aug 2024 13:44:20 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id BF6E7140A5C for ; Thu, 1 Aug 2024 17:44:19 +0000 (UTC) X-FDA: 82404400638.02.FC1527F Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by imf30.hostedemail.com (Postfix) with ESMTP id 399898001C for ; Thu, 1 Aug 2024 17:44:17 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of jonathan.cameron@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=jonathan.cameron@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722534228; a=rsa-sha256; cv=none; b=AsiHNXlBieFOmOWwWGzbpo3ibP/SloHyz8xOspHh5Xfk9ehP6nl1ik7g3oTk6lZgVeWab7 Ag9bGAwuN+Ymp2/yBaXQBBKhMzlv/4fAVeTh+1a3923IRPXx37YFd8qviVAGex3EInODms No33dKdVp69xp8lfX1xqW4NDKF42jnU= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of jonathan.cameron@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=jonathan.cameron@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722534228; h=from:from:sender: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=LXnybphf572bwJQi7c32ZGhQObLEFsQQQZzWOfMLtks=; b=hN7Czcg/m4r+jnI2tvHuPpa1IaWP/rmDhPEBx1tqYtVwPVNjnppjcKl8/J+YQvk7AZ1/nm CEDzppDlTpvNNqHujKO+l+IgKruc2rOFy2+Vws2X5ZqHe8Zoma3wGwOK/FbSPqF4rCG8L5 //jnZwInWOKSnlQZosrp9LOb51BIzXM= Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4WZbqf2c9cz6K6MB; Fri, 2 Aug 2024 01:41:34 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 6C75C1400F4; Fri, 2 Aug 2024 01:44:10 +0800 (CST) Received: from localhost (10.203.177.66) 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; Thu, 1 Aug 2024 18:44:09 +0100 Date: Thu, 1 Aug 2024 18:44:08 +0100 From: Jonathan Cameron To: Mike Rapoport CC: , Alexander Gordeev , Andreas Larsson , "Andrew Morton" , Arnd Bergmann , "Borislav Petkov" , Catalin Marinas , Christophe Leroy , Dan Williams , Dave Hansen , David Hildenbrand , "David S. Miller" , Davidlohr Bueso , "Greg Kroah-Hartman" , Heiko Carstens , Huacai Chen , Ingo Molnar , Jiaxun Yang , "John Paul Adrian Glaubitz" , Jonathan Corbet , Michael Ellerman , Palmer Dabbelt , "Rafael J. Wysocki" , Rob Herring , Samuel Holland , Thomas Bogendoerfer , Thomas Gleixner , "Vasily Gorbik" , Will Deacon , Zi Yan , , , , , , , , , , , , , , , , Subject: Re: [PATCH v3 02/26] MIPS: sgi-ip27: make NODE_DATA() the same as on all other architectures Message-ID: <20240801184408.00002e8b@Huawei.com> In-Reply-To: <20240801060826.559858-3-rppt@kernel.org> References: <20240801060826.559858-1-rppt@kernel.org> <20240801060826.559858-3-rppt@kernel.org> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.177.66] X-ClientProxiedBy: lhrpeml500001.china.huawei.com (7.191.163.213) To lhrpeml500005.china.huawei.com (7.191.163.240) X-Stat-Signature: ik94usnzemjx66x4neph3b4dp3ttsgi9 X-Rspamd-Queue-Id: 399898001C X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1722534257-828009 X-HE-Meta: U2FsdGVkX1/2GdxDIt0uRGKZBGheMa/a5o7cHQbdy4Rp1ue28qyZTPtMaewHCNQM2/r1kvFS34hHUdrB/DkQHbbPR9+jkOz4bdQf84d7njvzTu7A+fejUIPQoXZGRJXV296DatOsXLhT/iG+mIoRLswHGeM5VBsEs2eL6T8g34sfYUOXZWE47r6lytUG1ZW80GdFn3F0derJ+5vxlRhA/RiGOk3lHXm2Wlr7xiMpzpK0CMnlvxAmg0YnOh5t+2eBl2pxgOxOVO8NUdhB0HVESFz4Mnob0+KQklKdJofX7FLQoV8cPlSTBcmJezcdG0O1nDH20FPJCF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000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, 1 Aug 2024 09:08:02 +0300 Mike Rapoport wrote: > From: "Mike Rapoport (Microsoft)" > > sgi-ip27 is the only system that defines NODE_DATA() differently than > the rest of NUMA machines. > > Add node_data array of struct pglist pointers that will point to > __node_data[node]->pglist and redefine NODE_DATA() to use node_data > array. > > This will allow pulling declaration of node_data to the generic mm code > in the next commit. > > Signed-off-by: Mike Rapoport (Microsoft) After staring for a while at the use made of the other part of the __node_data I think what you have in this an the next two patches is fine. I'm far from convinced it was correct before though as arch_refresh_node_data() called on offline nodes in free_area_init() would have replaced __node_data with an allocation of size pg_data_t but the hub_data(), visible below, is after that. Maybe hub_data() as never called for offline nodes, but I couldn't establish that. After these patches the arch_refresh_node_data() generic version will only be replacing the pointer in node_data leaving the hub_data where it was in the first place and thus is fine. So with that in mind (and it could be completely wrong ;) Reviewed-by: Jonathan Cameron > --- > arch/mips/include/asm/mach-ip27/mmzone.h | 5 ++++- > arch/mips/sgi-ip27/ip27-memory.c | 5 ++++- > 2 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/arch/mips/include/asm/mach-ip27/mmzone.h b/arch/mips/include/asm/mach-ip27/mmzone.h > index 08c36e50a860..629c3f290203 100644 > --- a/arch/mips/include/asm/mach-ip27/mmzone.h > +++ b/arch/mips/include/asm/mach-ip27/mmzone.h > @@ -22,7 +22,10 @@ struct node_data { > > extern struct node_data *__node_data[]; > > -#define NODE_DATA(n) (&__node_data[(n)]->pglist) > #define hub_data(n) (&__node_data[(n)]->hub) > > +extern struct pglist_data *node_data[]; > + > +#define NODE_DATA(nid) (node_data[nid]) > + > #endif /* _ASM_MACH_MMZONE_H */ > diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c > index b8ca94cfb4fe..c30ef6958b97 100644 > --- a/arch/mips/sgi-ip27/ip27-memory.c > +++ b/arch/mips/sgi-ip27/ip27-memory.c > @@ -34,8 +34,10 @@ > #define SLOT_PFNSHIFT (SLOT_SHIFT - PAGE_SHIFT) > #define PFN_NASIDSHFT (NASID_SHFT - PAGE_SHIFT) > > -struct node_data *__node_data[MAX_NUMNODES]; > +struct pglist_data *node_data[MAX_NUMNODES]; > +EXPORT_SYMBOL(node_data); > > +struct node_data *__node_data[MAX_NUMNODES]; > EXPORT_SYMBOL(__node_data); > > static u64 gen_region_mask(void) > @@ -361,6 +363,7 @@ static void __init node_mem_init(nasid_t node) > */ > __node_data[node] = __va(slot_freepfn << PAGE_SHIFT); > memset(__node_data[node], 0, PAGE_SIZE); > + node_data[node] = &__node_data[node]->pglist; > > NODE_DATA(node)->node_start_pfn = start_pfn; > NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn;