From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C83C3C2D6; Fri, 19 Jul 2024 14:38:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721399940; cv=none; b=sqp4/0Krl8vwmWTIp6QKtL/SAyfo25kLIr4Y0lbUshfsgbELEEdOvORh1scCnNj3UHbDilVuuihtXLbRdBxH+G+BHGsW3HL19h0NSq7s6pESAmtsEEoeJgSejVEDggS6Ib4lkWerMb4WnE+L7PT+aGp8XjbX4HEF0+078QqsyLQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721399940; c=relaxed/simple; bh=MthLwAZw/K/pHDsypzwnpxxVpjnrL/t3lpnlDB9Cp0s=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mOAi+7thFhKnKaktgyzcse1NQeHqjm6hDQ8FzbruE/hG3pderNui9BF0sgLil2BSsAy6CWqk35kfL9ypenfiTbhqhwdn/3gsNA9qdSJPlgoY6FKEKUJ/vi07eDJAiUjrrEncJMBqF1PCRQ6vv/hNhVMHAAhn9tRujzFwPmbIGSE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4WQXMF48rrz6JBjL; Fri, 19 Jul 2024 22:37:29 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id D6E9D140684; Fri, 19 Jul 2024 22:38:53 +0800 (CST) Received: from localhost (10.203.174.77) 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; Fri, 19 Jul 2024 15:38:53 +0100 Date: Fri, 19 Jul 2024 15:38:52 +0100 From: Jonathan Cameron To: David Hildenbrand CC: Mike Rapoport , , "Alexander Gordeev" , Andreas Larsson , Andrew Morton , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christophe Leroy , Dan Williams , Dave Hansen , "David S. Miller" , Greg Kroah-Hartman , Heiko Carstens , "Huacai Chen" , Ingo Molnar , Jiaxun Yang , John Paul Adrian Glaubitz , Michael Ellerman , Palmer Dabbelt , "Rafael J. Wysocki" , Rob Herring , Thomas Bogendoerfer , Thomas Gleixner , "Vasily Gorbik" , Will Deacon , , , , , , , , , , , , , , , Subject: Re: [PATCH 02/17] MIPS: sgi-ip27: make NODE_DATA() the same as on all other architectures Message-ID: <20240719153852.00003f44@Huawei.com> In-Reply-To: References: <20240716111346.3676969-1-rppt@kernel.org> <20240716111346.3676969-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) Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml500004.china.huawei.com (7.191.163.9) To lhrpeml500005.china.huawei.com (7.191.163.240) On Wed, 17 Jul 2024 16:32:59 +0200 David Hildenbrand wrote: > On 16.07.24 13:13, 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) > > --- > > 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; > > I was assuming we could get rid of __node_data->pglist. > > But now I am confused where that is actually set. It looks nasty... Cast in arch_refresh_nodedata() takes incoming pg_data_t * and casts it to the local version of struct node_data * which I think is this one struct node_data { struct pglist_data pglist; (which is pg_data_t pglist) struct hub_data hub; }; https://elixir.bootlin.com/linux/v6.10/source/arch/mips/sgi-ip27/ip27-memory.c#L432 Now that pg_data_t is allocated by arch_alloc_nodedata() which might be fine (though types could be handled in a more readable fashion via some container_of() magic. https://elixir.bootlin.com/linux/v6.10/source/arch/mips/sgi-ip27/ip27-memory.c#L427 However that call is: pg_data_t * __init arch_alloc_nodedata(int nid) { return memblock_alloc(sizeof(pg_data_t), SMP_CACHE_BYTES); } So doesn't seem to allocate enough space to me as should be sizeof(struct node_data) Worth cleaning up whilst here? Proper handling of types would definitely help. Jonathan > > Anyhow > > Reviewed-by: David Hildenbrand > 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 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 5E53AC3DA5D for ; Fri, 19 Jul 2024 14:39:30 +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:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3Z/3LrOnnQJguIKbCf6eGRHXbN5ivQdrlqb/xJ7VuH4=; b=ZNoH1ieclPE3Qj Hp5wH4s6k8AVcxhHfQ8tkf7HS4tYgf9ywxFAqc/JZtx4fAaFUKEepQX/xYBl2KNxqIcmENQQ5dS/6 DPAA24atSplnZhLNVYLtpfNqcvWWliicFY2id7lHljRYp017M7J1KyK+gyU//p5hOGMpGVoYxb3KS PqyhvyjjGprOPRJ4tPVpXdW5zMIJqwGxjluFErLw250dK46tCiXVorPmM06X5mloSDSKTIZ6Qq+ZY VZNekLGwBavn9D//R33gpKqXr/J7MM/0g12S9M8/O8c1SQn/ed+MukkM3VysHtdLPHCvH4WdOCWds VFx+vOPhgh2XriYLpHpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUola-00000002xlb-2zHg; Fri, 19 Jul 2024 14:39:26 +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 1sUolD-00000002xck-0aBV; Fri, 19 Jul 2024 14:39:05 +0000 Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4WQXMF48rrz6JBjL; Fri, 19 Jul 2024 22:37:29 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id D6E9D140684; Fri, 19 Jul 2024 22:38:53 +0800 (CST) Received: from localhost (10.203.174.77) 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; Fri, 19 Jul 2024 15:38:53 +0100 Date: Fri, 19 Jul 2024 15:38:52 +0100 From: Jonathan Cameron To: David Hildenbrand CC: Mike Rapoport , , "Alexander Gordeev" , Andreas Larsson , Andrew Morton , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christophe Leroy , Dan Williams , Dave Hansen , "David S. Miller" , Greg Kroah-Hartman , Heiko Carstens , "Huacai Chen" , Ingo Molnar , Jiaxun Yang , John Paul Adrian Glaubitz , Michael Ellerman , Palmer Dabbelt , "Rafael J. Wysocki" , Rob Herring , Thomas Bogendoerfer , Thomas Gleixner , "Vasily Gorbik" , Will Deacon , , , , , , , , , , , , , , , Subject: Re: [PATCH 02/17] MIPS: sgi-ip27: make NODE_DATA() the same as on all other architectures Message-ID: <20240719153852.00003f44@Huawei.com> In-Reply-To: References: <20240716111346.3676969-1-rppt@kernel.org> <20240716111346.3676969-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 X-Originating-IP: [10.203.174.77] X-ClientProxiedBy: lhrpeml500004.china.huawei.com (7.191.163.9) 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-20240719_073903_477204_EEE5DA3A X-CRM114-Status: GOOD ( 26.97 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Wed, 17 Jul 2024 16:32:59 +0200 David Hildenbrand wrote: > On 16.07.24 13:13, 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) > > --- > > 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; > > I was assuming we could get rid of __node_data->pglist. > > But now I am confused where that is actually set. It looks nasty... Cast in arch_refresh_nodedata() takes incoming pg_data_t * and casts it to the local version of struct node_data * which I think is this one struct node_data { struct pglist_data pglist; (which is pg_data_t pglist) struct hub_data hub; }; https://elixir.bootlin.com/linux/v6.10/source/arch/mips/sgi-ip27/ip27-memory.c#L432 Now that pg_data_t is allocated by arch_alloc_nodedata() which might be fine (though types could be handled in a more readable fashion via some container_of() magic. https://elixir.bootlin.com/linux/v6.10/source/arch/mips/sgi-ip27/ip27-memory.c#L427 However that call is: pg_data_t * __init arch_alloc_nodedata(int nid) { return memblock_alloc(sizeof(pg_data_t), SMP_CACHE_BYTES); } So doesn't seem to allocate enough space to me as should be sizeof(struct node_data) Worth cleaning up whilst here? Proper handling of types would definitely help. Jonathan > > Anyhow > > Reviewed-by: David Hildenbrand > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 B4994C3DA59 for ; Fri, 19 Jul 2024 14:39:29 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4WQXPW6Rrjz3cdZ for ; Sat, 20 Jul 2024 00:39:27 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com (client-ip=185.176.79.56; helo=frasgout.his.huawei.com; envelope-from=jonathan.cameron@huawei.com; receiver=lists.ozlabs.org) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4WQXP524Dmz3c4l for ; Sat, 20 Jul 2024 00:39:01 +1000 (AEST) Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4WQXMF48rrz6JBjL; Fri, 19 Jul 2024 22:37:29 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id D6E9D140684; Fri, 19 Jul 2024 22:38:53 +0800 (CST) Received: from localhost (10.203.174.77) 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; Fri, 19 Jul 2024 15:38:53 +0100 Date: Fri, 19 Jul 2024 15:38:52 +0100 From: Jonathan Cameron To: David Hildenbrand Subject: Re: [PATCH 02/17] MIPS: sgi-ip27: make NODE_DATA() the same as on all other architectures Message-ID: <20240719153852.00003f44@Huawei.com> In-Reply-To: References: <20240716111346.3676969-1-rppt@kernel.org> <20240716111346.3676969-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.174.77] X-ClientProxiedBy: lhrpeml500004.china.huawei.com (7.191.163.9) To lhrpeml500005.china.huawei.com (7.191.163.240) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nvdimm@lists.linux.dev, x86@kernel.org, Andreas Larsson , Catalin Marinas , Dave Hansen , Jiaxun Yang , linux-mips@vger.kernel.org, linux-mm@kvack.org, sparclinux@vger.kernel.org, Alexander Gordeev , Will Deacon , Thomas Gleixner , linux-arch@vger.kernel.org, Rob Herring , Vasily Gorbik , linux-sh@vger.kernel.org, Huacai Chen , Christophe Leroy , linux-acpi@vger.kernel.org, Ingo Molnar , devicetree@vger.kernel.org, Arnd Bergmann , linux-s390@vger.kernel.org, Heiko Carstens , Borislav Petkov , linux-cxl@vger.kernel.org, loongarch@lists.linux.dev, John Paul Adrian Glaubitz , Dan Williams , linux-arm-kernel@lists.infradead.org, Thomas Bogendoerfer , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , "Rafael J. Wysocki" , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S. Miller" , Mike Rapoport Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, 17 Jul 2024 16:32:59 +0200 David Hildenbrand wrote: > On 16.07.24 13:13, 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) > > --- > > 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; > > I was assuming we could get rid of __node_data->pglist. > > But now I am confused where that is actually set. It looks nasty... Cast in arch_refresh_nodedata() takes incoming pg_data_t * and casts it to the local version of struct node_data * which I think is this one struct node_data { struct pglist_data pglist; (which is pg_data_t pglist) struct hub_data hub; }; https://elixir.bootlin.com/linux/v6.10/source/arch/mips/sgi-ip27/ip27-memory.c#L432 Now that pg_data_t is allocated by arch_alloc_nodedata() which might be fine (though types could be handled in a more readable fashion via some container_of() magic. https://elixir.bootlin.com/linux/v6.10/source/arch/mips/sgi-ip27/ip27-memory.c#L427 However that call is: pg_data_t * __init arch_alloc_nodedata(int nid) { return memblock_alloc(sizeof(pg_data_t), SMP_CACHE_BYTES); } So doesn't seem to allocate enough space to me as should be sizeof(struct node_data) Worth cleaning up whilst here? Proper handling of types would definitely help. Jonathan > > Anyhow > > Reviewed-by: David Hildenbrand >