linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Holasek <pholasek@redhat.com>
To: Cliff Wickman <cpw@sgi.com>
Cc: linux-numa@vger.kernel.org, Petr Holasek <pholasek@redhat.com>
Subject: [PATCH] numactl: new --allphyscpubind/-A option
Date: Thu,  5 Sep 2013 16:14:11 +0200	[thread overview]
Message-ID: <1378390451-25639-1-git-send-email-pholasek@redhat.com> (raw)

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

             reply	other threads:[~2013-09-05 14:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-05 14:14 Petr Holasek [this message]
2013-09-05 16:45 ` [PATCH] numactl: new --allphyscpubind/-A option Andi Kleen
2013-09-05 19:54   ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1378390451-25639-1-git-send-email-pholasek@redhat.com \
    --to=pholasek@redhat.com \
    --cc=cpw@sgi.com \
    --cc=linux-numa@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).