cdown / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
0b5e55
diff -up util-linux-2.23.2/sys-utils/lscpu.c.kzak util-linux-2.23.2/sys-utils/lscpu.c
0b5e55
--- util-linux-2.23.2/sys-utils/lscpu.c.kzak	2014-01-14 14:02:52.228996385 +0100
0b5e55
+++ util-linux-2.23.2/sys-utils/lscpu.c	2014-01-14 14:04:08.109795733 +0100
0b5e55
@@ -815,6 +815,13 @@ static inline int is_node_dirent(struct
0b5e55
 		isdigit_string(d->d_name + 4);
0b5e55
 }
0b5e55
 
0b5e55
+static int
0b5e55
+nodecmp(const void *ap, const void *bp)
0b5e55
+{
0b5e55
+	int *a = (int *) ap, *b = (int *) bp;
0b5e55
+	return *a - *b;
0b5e55
+}
0b5e55
+
0b5e55
 static void
0b5e55
 read_nodes(struct lscpu_desc *desc)
0b5e55
 {
0b5e55
@@ -850,6 +857,7 @@ read_nodes(struct lscpu_desc *desc)
0b5e55
 							_("Failed to extract the node number"));
0b5e55
 		}
0b5e55
 		closedir(dir);
0b5e55
+		qsort(desc->idx2nodenum, desc->nnodes, sizeof(int), nodecmp);
0b5e55
 	}
0b5e55
 
0b5e55
 	/* information about how nodes share different CPUs */
0b5e55
diff -up util-linux-2.23.2/tests/expected/lscpu/lscpu-x86_64-64cpu.kzak util-linux-2.23.2/tests/expected/lscpu/lscpu-x86_64-64cpu
0b5e55
--- util-linux-2.23.2/tests/expected/lscpu/lscpu-x86_64-64cpu.kzak	2013-06-13 09:46:10.551651742 +0200
0b5e55
+++ util-linux-2.23.2/tests/expected/lscpu/lscpu-x86_64-64cpu	2014-01-14 14:04:29.662022613 +0100
0b5e55
@@ -4,7 +4,7 @@ On-line CPU(s) list:   0-63
0b5e55
 Thread(s) per core:    2
0b5e55
 Core(s) per socket:    8
0b5e55
 Socket(s):             4
0b5e55
-NUMA node(s):          1
0b5e55
+NUMA node(s):          3
0b5e55
 Vendor ID:             GenuineIntel
0b5e55
 CPU family:            6
0b5e55
 Model:                 46
0b5e55
@@ -18,72 +18,74 @@ L1i cache:             32K
0b5e55
 L2 cache:              256K
0b5e55
 L3 cache:              18432K
0b5e55
 NUMA node0 CPU(s):     0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62
0b5e55
+NUMA node2 CPU(s):     1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61
0b5e55
+NUMA node3 CPU(s):     3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63
0b5e55
 
0b5e55
 # The following is the parsable format, which can be fed to other
0b5e55
 # programs. Each different item in every column has an unique ID
0b5e55
 # starting from zero.
0b5e55
 # CPU,Core,Socket,Node,,L1d,L1i,L2,L3
0b5e55
 0,0,0,0,,0,0,0,0
0b5e55
-1,1,1,,,1,1,1,1
0b5e55
+1,1,1,2,,1,1,1,1
0b5e55
 2,2,2,0,,2,2,2,2
0b5e55
-3,3,3,,,3,3,3,3
0b5e55
+3,3,3,3,,3,3,3,3
0b5e55
 4,4,0,0,,4,4,4,0
0b5e55
-5,5,1,,,5,5,5,1
0b5e55
+5,5,1,2,,5,5,5,1
0b5e55
 6,6,2,0,,6,6,6,2
0b5e55
-7,7,3,,,7,7,7,3
0b5e55
+7,7,3,3,,7,7,7,3
0b5e55
 8,8,0,0,,8,8,8,0
0b5e55
-9,9,1,,,9,9,9,1
0b5e55
+9,9,1,2,,9,9,9,1
0b5e55
 10,10,2,0,,10,10,10,2
0b5e55
-11,11,3,,,11,11,11,3
0b5e55
+11,11,3,3,,11,11,11,3
0b5e55
 12,12,0,0,,12,12,12,0
0b5e55
-13,13,1,,,13,13,13,1
0b5e55
+13,13,1,2,,13,13,13,1
0b5e55
 14,14,2,0,,14,14,14,2
0b5e55
-15,15,3,,,15,15,15,3
0b5e55
+15,15,3,3,,15,15,15,3
0b5e55
 16,16,0,0,,16,16,16,0
0b5e55
-17,17,1,,,17,17,17,1
0b5e55
+17,17,1,2,,17,17,17,1
0b5e55
 18,18,2,0,,18,18,18,2
0b5e55
-19,19,3,,,19,19,19,3
0b5e55
+19,19,3,3,,19,19,19,3
0b5e55
 20,20,0,0,,20,20,20,0
0b5e55
-21,21,1,,,21,21,21,1
0b5e55
+21,21,1,2,,21,21,21,1
0b5e55
 22,22,2,0,,22,22,22,2
0b5e55
-23,23,3,,,23,23,23,3
0b5e55
+23,23,3,3,,23,23,23,3
0b5e55
 24,24,0,0,,24,24,24,0
0b5e55
-25,25,1,,,25,25,25,1
0b5e55
+25,25,1,2,,25,25,25,1
0b5e55
 26,26,2,0,,26,26,26,2
0b5e55
-27,27,3,,,27,27,27,3
0b5e55
+27,27,3,3,,27,27,27,3
0b5e55
 28,28,0,0,,28,28,28,0
0b5e55
-29,29,1,,,29,29,29,1
0b5e55
+29,29,1,2,,29,29,29,1
0b5e55
 30,30,2,0,,30,30,30,2
0b5e55
-31,31,3,,,31,31,31,3
0b5e55
+31,31,3,3,,31,31,31,3
0b5e55
 32,0,0,0,,0,0,0,0
0b5e55
-33,1,1,,,1,1,1,1
0b5e55
+33,1,1,2,,1,1,1,1
0b5e55
 34,2,2,0,,2,2,2,2
0b5e55
-35,3,3,,,3,3,3,3
0b5e55
+35,3,3,3,,3,3,3,3
0b5e55
 36,4,0,0,,4,4,4,0
0b5e55
-37,5,1,,,5,5,5,1
0b5e55
+37,5,1,2,,5,5,5,1
0b5e55
 38,6,2,0,,6,6,6,2
0b5e55
-39,7,3,,,7,7,7,3
0b5e55
+39,7,3,3,,7,7,7,3
0b5e55
 40,8,0,0,,8,8,8,0
0b5e55
-41,9,1,,,9,9,9,1
0b5e55
+41,9,1,2,,9,9,9,1
0b5e55
 42,10,2,0,,10,10,10,2
0b5e55
-43,11,3,,,11,11,11,3
0b5e55
+43,11,3,3,,11,11,11,3
0b5e55
 44,12,0,0,,12,12,12,0
0b5e55
-45,13,1,,,13,13,13,1
0b5e55
+45,13,1,2,,13,13,13,1
0b5e55
 46,14,2,0,,14,14,14,2
0b5e55
-47,15,3,,,15,15,15,3
0b5e55
+47,15,3,3,,15,15,15,3
0b5e55
 48,16,0,0,,16,16,16,0
0b5e55
-49,17,1,,,17,17,17,1
0b5e55
+49,17,1,2,,17,17,17,1
0b5e55
 50,18,2,0,,18,18,18,2
0b5e55
-51,19,3,,,19,19,19,3
0b5e55
+51,19,3,3,,19,19,19,3
0b5e55
 52,20,0,0,,20,20,20,0
0b5e55
-53,21,1,,,21,21,21,1
0b5e55
+53,21,1,2,,21,21,21,1
0b5e55
 54,22,2,0,,22,22,22,2
0b5e55
-55,23,3,,,23,23,23,3
0b5e55
+55,23,3,3,,23,23,23,3
0b5e55
 56,24,0,0,,24,24,24,0
0b5e55
-57,25,1,,,25,25,25,1
0b5e55
+57,25,1,2,,25,25,25,1
0b5e55
 58,26,2,0,,26,26,26,2
0b5e55
-59,27,3,,,27,27,27,3
0b5e55
+59,27,3,3,,27,27,27,3
0b5e55
 60,28,0,0,,28,28,28,0
0b5e55
-61,29,1,,,29,29,29,1
0b5e55
+61,29,1,2,,29,29,29,1
0b5e55
 62,30,2,0,,30,30,30,2
0b5e55
-63,31,3,,,31,31,31,3
0b5e55
+63,31,3,3,,31,31,31,3