Thread (19 messages) flat view 19 messages, 7 authors, 2007-12-09

Re: [PATCH] Fake NUMA emulation for PowerPC

From: Balbir Singh <hidden>
Date: 2007-12-07 21:35:43
Also in: lkml

Olof Johansson wrote:
Hi,

On Sat, Dec 08, 2007 at 02:44:25AM +0530, Balbir Singh wrote:
quoted
Comments are as always welcome!
Care to explain what this is useful for? (Not saying it's a stupid idea,
just wondering what the reason for doing it is).
In my case, I use it to test parts of my memory controller patches on an
emulated NUMA machine. I plan to use it to test out page migration
across nodes.
quoted
diff -puN arch/powerpc/mm/numa.c~ppc-fake-numa-easy arch/powerpc/mm/numa.c
--- linux-2.6.24-rc4-mm1/arch/powerpc/mm/numa.c~ppc-fake-numa-easy	2007-12-07 21:25:55.000000000 +0530
+++ linux-2.6.24-rc4-mm1-balbir/arch/powerpc/mm/numa.c	2007-12-08 02:36:02.000000000 +0530
@@ -24,6 +24,8 @@
 
 static int numa_enabled = 1;
 
+char *cmdline __initdata;
+
Looks like this should be static.
Yes, good catch!
quoted
@@ -702,6 +744,9 @@ static int __init early_numa(char *p)
 	if (strstr(p, "debug"))
 		numa_debug = 1;
 
+	if (strstr(p, "fake="))
+		cmdline = p + 5;	/* 5 is faster than strlen("fake=") */
This doesn't look right.

You check if it contains fake=, not if it starts with it. So if someone
did: "numa=foo,fake=bar", or even "numa=debug,fake=", things wouldn't
work right.
Yes, you are right. I merely followed the strstr convention already
present, which as you righly point out is wrong. I suspect I need to do
something like

p = strstr(p, "fake=")
if (p)
	cmdline = p + 5;

This would still allow us to do things like

numa=foo,fake=bar but the memparse() utility would fail at fake=bar
								^^^

or even

numa=debug,fake=1G

I suspect that this should be good enough for a command line option.
-Olof

-- 
	Thanks,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help