[PATCH] numactl: new --allphyscpubind/-A option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(-)

diff --git a/numactl-2.0.9-rc3/numactl.8 b/numactl-2.0.9-rc3/numactl.8
index 576cdb6..197a43b 100644
--- a/numactl-2.0.9-rc3/numactl.8
+++ b/numactl-2.0.9-rc3/numactl.8
@@ -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
diff --git a/numactl-2.0.9-rc3/numactl.c b/numactl-2.0.9-rc3/numactl.c
index e1d5487..afb883a 100755
--- a/numactl-2.0.9-rc3/numactl.c
+++ b/numactl-2.0.9-rc3/numactl.c
@@ -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();
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-numa" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]     [Devices]

  Powered by Linux