Skip to contentSkip to conversation

numactl: new --allphyscpubind/-A option

PATCH In review Petr Holasek 2 participants 3 messages Sep 5, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 numactl: new --allphyscpubind/-A option

This patch adds new --allphyscpubind/-A option to set cpu bind to all possible physical CPUs, not only to ones from the current cpuset as --physcpubind does now.

We have discussed this topic about year ago here:

http://thread.gmane.org/gmane.linux.kernel.numa/798

best regards,
Petr H

---
 numactl-2.0.9-rc3/numactl.8 |  9 +++++++++
 numactl-2.0.9-rc3/numactl.c | 11 ++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)
numactl-2.0.9-rc3/numactl.8 +9 -0
index 576cdb6..197a43b 100644
@@ -33,6 +33,8 @@ numactl \- Control NUMA policy for processes or shared memory
 ] [
 .B \-\-physcpubind cpus
 ] [
+.B \-\-allphyscpubind cpus
+] [
 .B \-\-localalloc
 ] [\-\-] command {arguments ...}
 .br
@@ -152,6 +154,13 @@ current cpuset.
 A !N-N notation indicates the inverse of N-N, in other words all cpus
 except N-N.  If used with + notation, specify !+N-N.
 .TP
+.B \-\-allphyscpubind=cpus, \-A cpus
+Same as
+.I \-\-physcpubind
+but can bind
+.I process
+to all available physical CPUs, not only to CPUs from the current cpuset.
+.TP
 .B \-\-localalloc, \-l 
 Always allocate on the current node.
 .TP
numactl-2.0.9-rc3/numactl.c +8 -3
index e1d5487..afb883a 100755
@@ -37,6 +37,7 @@ struct option opts[] = {
 	{"cpubind", 1, 0, 'c' },
 	{"cpunodebind", 1, 0, 'N' },
 	{"physcpubind", 1, 0, 'C' },
+	{"allphyscpubind", 1, 0, 'A'},
 	{"membind", 1, 0, 'm'},
 	{"show", 0, 0, 's' },
 	{"localalloc", 0,0, 'l'},
@@ -61,7 +62,7 @@ void usage(void)
 {
 	fprintf(stderr,
 		"usage: numactl [--interleave= | -i <nodes>] [--preferred= | -p <node>]\n"
-		"               [--physcpubind= | -C <cpus>] [--cpunodebind= | -N <nodes>]\n"
+		"               [--allphyscpubind= | -A <cpus>] [--physcpubind= | -C <cpus>] [--cpunodebind= | -N <nodes>]\n"
 		"               [--membind= | -m <nodes>] [--localalloc | -l] command args ...\n"
 		"       numactl [--show | -s]\n"
 		"       numactl [--hardware | -H]\n"
@@ -443,10 +444,14 @@ int main(int ac, char **av)
 			checkerror("sched_setaffinity");
 			break;
 		case 'C': /* --physcpubind */
+		case 'A': /* --allphyscpubind */
 		{
 			struct bitmask *cpubuf;
-			dontshm("-C/--physcpubind");
-			cpubuf = numa_parse_cpustring(optarg);
+			dontshm("-C/--physcpubind/-A/--allphyscpubind");
+			if (c == 'C')
+				cpubuf = numa_parse_cpustring(optarg);
+			else
+				cpubuf = numa_parse_cpustring_all(optarg);
 			if (!cpubuf) {
 				printf ("<%s> is invalid\n", optarg);
 				usage();
Signature · 1 line
1.8.1.4
#1 lore raw
Quoted 7 lines · Petr Holasek

This patch adds new --allphyscpubind/-A option to set cpu bind to all possible physical CPUs, not only to ones from the current cpuset as --physcpubind does now.

We have discussed this topic about year ago here:

http://thread.gmane.org/gmane.linux.kernel.numa/798

Patch looks good to me.

-Andi

#2 lore raw
Quoted 10 lines · Andi Kleen
Quoted 7 lines · Petr Holasek

This patch adds new --allphyscpubind/-A option to set cpu bind to all possible physical CPUs, not only to ones from the current cpuset as --physcpubind does now.

We have discussed this topic about year ago here:

http://thread.gmane.org/gmane.linux.kernel.numa/798

Patch looks good to me.

Actually on second thought a separate --all argument that disables cpusets for everything would be better.

-Andi