Re: [PATCH powerpc] Fake NUMA emulation for PowerPC (Take 3)

From: Michael Ellerman
Date: Tue Jan 29 2008 - 08:05:27 EST


On Mon, 2008-01-28 at 18:22 +0530, Balbir Singh wrote:
> Hi, Paul,
>
> Here's version 3 of the patch. I've commented the side-effect of
> repeatedly setting node 0 online (as to why that is done) and I've
> removed the side effect of not creating memory less nodes
> (when we hit the memory limit).
>
> I've described all my tests below
>
> Changelog v3
> 1. Remove the side-effect of not setting nodes online if they end
> up having no memory in them because of the memory limit.
>
> Changelog v2
>
> 1. Get rid of the constant 5 (based on comments from
> Geert.Uytterhoeven@xxxxxxxxxxx)
> 2. Implement suggestions from Olof Johannson
> 3. Check if cmdline is NULL in fake_numa_create_new_node()

> diff -puN arch/powerpc/mm/numa.c~fakenumappc arch/powerpc/mm/numa.c
> --- linux-2.6.24-rc8/arch/powerpc/mm/numa.c~fakenumappc 2008-01-28 17:05:34.000000000 +0530
> +++ linux-2.6.24-rc8-balbir/arch/powerpc/mm/numa.c 2008-01-28 18:15:41.000000000 +0530
> @@ -39,6 +41,47 @@ static bootmem_data_t __initdata plat_no
> static int min_common_depth;
> static int n_mem_addr_cells, n_mem_size_cells;
>
> +static int __cpuinit fake_numa_create_new_node(unsigned long end_pfn,
> + unsigned int *nid)
> +{
> + unsigned long long mem;
> + char *p = cmdline;
> + static unsigned int fake_nid;
> + static unsigned long long curr_boundary;
> +
> + /*
> + * Modify node id, iff we started creating NUMA nodes
> + */
> + if (fake_nid)
> + *nid = fake_nid;
> + if (!p)
> + return 0;

Why do you check !p after assigning to nid? I assume it's because we
might have reached the end of the command line, ie. p == NULL, but we're
still adding memory to the last node? If so it's a it's a little subtle
and deserves a comment I think.

Otherwise this looks pretty good.

cheers

--
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

Attachment: signature.asc
Description: This is a digitally signed message part