Date:	Tue, 22 Jul 2008 16:21:07 +0800
From: Kent Liu <kent.liu@linux.intel.com>
To: linux-numa@vger.kernel.org
Cc: kent.liu@linux.intel.com
Subject: [PATCH] Min/Max in numademo output is confusing

Hello,

Original Min/Max in numademo output is confusing. The 'Min' meant the
minimum time the operation have been occupied, while the printed numbers 
are bandwidth data, which has reversed meaning in terms of quantity.
Reverting Min/Max in the print message is better.

Subject: [PATCH] Fix numademo segfault issue

numademo will crash if some options are added. For example, a simple
"numademo -c 20m memcpy" will cause a segmentation fault after memcpy
tests completed. 

This issue has been there for long time as I can see it in both SuSE
and RHEL distros, and 2.0.2-rc2 package.

This patch fixes the segfault by adjusting variable ac to avoid array
index overflow.


Signed-off-by: Kent Liu <kent.liu@linux.intel.com>

Date: Fri, 25 Jul 2008 21:21:50 +0200
From: Andi Kleen <andi@firstfloor.org>
To: Kent Liu <kent.liu@linux.intel.com>
Subject: Re: [PATCH] Min/Max in numademo output is confusing

Thanks. Both patches look good to me. I assume Cliff will merge them.

-Andi
---

---
 numademo.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: numactl-dev/numademo.c
===================================================================
--- numactl-dev.orig/numademo.c
+++ numactl-dev/numademo.c
@@ -249,7 +249,7 @@ void memtest(char *name, unsigned char *
 	sprintf(title, "%s%s%s", name, delim, testname[thistest]); 
 #define H(t) (((double)msize) / ((double)t))
 #define D3 delim,delim,delim
-	sprintf(result, "Avg%s%.2f%sMB/s%sMin%s%.2f%sMB/s%sMax%s%.2f%sMB/s",
+	sprintf(result, "Avg%s%.2f%sMB/s%sMax%s%.2f%sMB/s%sMin%s%.2f%sMB/s",
 		delim,
 		H(sum/LOOPS), 
 		D3,
@@ -448,6 +448,7 @@ int main(int ac, char **av)
 	int simple_tests = 0;
 	
 	while (av[1] && av[1][0] == '-') { 
+		ac--;
 		switch (av[1][1]) { 
 		case 'c': 
 			delim = ","; 
