Re: [PATCH v3 09/26] arch, mm: pull out allocation of NODE_DATA to generic code

Mike Rapoport <[email protected]>
Newsgroups gmane.linux.acpi.devel,gmane.linux.kernel,gmane.linux.drivers.devicetree,gmane.linux.kernel.cross-arch,gmane.linux.ports.arm.kernel,gmane.linux.documentation,gmane.linux.ports.mips,gmane.linux.kernel.mm,gmane.linux.ports.riscv,gmane.linux.ports.sh.devel,gmane.linux.ports.ppc64.devel,gmane.linux.ports.sparc
Message-ID <[email protected]>
On Fri, Aug 02, 2024 at 10:55:27AM +0100, Jonathan Cameron wrote:
> On Thu,  1 Aug 2024 09:08:09 +0300
> Mike Rapoport <[email protected]> wrote:
> 
> > From: "Mike Rapoport (Microsoft)" <[email protected]>
> > 
> > Architectures that support NUMA duplicate the code that allocates
> > NODE_DATA on the node-local memory with slight variations in reporting
> > of the addresses where the memory was allocated.
> > 
> > Use x86 version as the basis for the generic alloc_node_data() function
> > and call this function in architecture specific numa initialization.
> > 
> > Round up node data size to SMP_CACHE_BYTES rather than to PAGE_SIZE like
> > x86 used to do since the bootmem era when allocation granularity was
> > PAGE_SIZE anyway.
> > 
> > Signed-off-by: Mike Rapoport (Microsoft) <[email protected]>
> > Acked-by: David Hildenbrand <[email protected]>
> > Reviewed-by: Jonathan Cameron <[email protected]>
> > Tested-by: Zi Yan <[email protected]> # for x86_64 and arm64
> 
> One comment unrelated to this patch set as such, just made
> more obvious by it.
> 
> > diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> > index 0744a9a2944b..3c1da08304d0 100644
> > --- a/arch/powerpc/mm/numa.c
> > +++ b/arch/powerpc/mm/numa.c
> > @@ -1093,27 +1093,9 @@ void __init dump_numa_cpu_topology(void)
> >  static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
> >  {
> >  	u64 spanned_pages = end_pfn - start_pfn;
> 
> Trivial, but might as well squash this local variable into the
> single place it's used.
 

> > -	const size_t nd_size = roundup(sizeof(pg_data_t), SMP_CACHE_BYTES);

...

> > +
> > +	alloc_node_data(nid);
> > +
> >  	NODE_DATA(nid)->node_id = nid;
> >  	NODE_DATA(nid)->node_start_pfn = start_pfn;
> >  	NODE_DATA(nid)->node_spanned_pages = spanned_pages;

These are actually overridden later in free_area_init(), it would make
sense to audit all arch-specific node setup functions and clean them up a
bit.

-- 
Sincerely yours,
Mike.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.