From: Andi Kleen <andi@firstfloor.org>
To: cpw@sgi.com
Cc: linux-numa@vger.kernel.org, Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 1/8] Add support for a "same" numamask to numactl
Date: Wed, 14 Dec 2011 11:38:31 -0800 [thread overview]
Message-ID: <1323891518-1493-1-git-send-email-andi@firstfloor.org> (raw)
From: Andi Kleen <ak@linux.intel.com>
With more complicated node masks it gets a bit annoying
to type them multiple times, e.g. for -c and -m. Add
a "same" alias that just refers to the previous nodemask.
Since this is only well defined on the command line implement
it in numactl only.
---
CHANGES | 3 +++
numactl.8 | 4 +++-
numactl.c | 22 ++++++++++++++++++----
4 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/CHANGES b/CHANGES
index f8cb229..d63aa12 100644
--- a/CHANGES
+++ b/CHANGES
@@ -356,3 +356,6 @@ newer:
- 110818 Checking of sucessful allocations in numademo (Petr Holasek)
2.0.8-rc2
- 110823 Fix of numactl (--touch) warnings and man page (Cliff W.)
+
+
+- Add "same" nodemask alias to numactl (Andi Kleen)
diff --git a/numactl.8 b/numactl.8
index e5c7ef6..684e80a 100644
--- a/numactl.8
+++ b/numactl.8
@@ -95,7 +95,9 @@ may be specifed as +N,N,N or +N-N or +N,N-N and so forth. The + indicates that
the node numbers are relative to the process' set of allowed nodes in its
current cpuset.
A !N-N notation indicates the inverse of N-N, in other words all nodes
-except N-N. If used with + notation, specify !+N-N.
+except N-N. If used with + notation, specify !+N-N. When
+.I same
+is specified the previous nodemask specified on the command line is used.
.TP
.B \-\-membind=nodes, \-m nodes
Only allocate memory from nodes. Allocation will fail when there
diff --git a/numactl.c b/numactl.c
index a47a2cf..d1be03c 100755
--- a/numactl.c
+++ b/numactl.c
@@ -366,6 +366,20 @@ void check_shmbeyond(char *msg)
}
}
+static struct bitmask *numactl_parse_nodestring(char *s)
+{
+ static char *last;
+
+ if (s[0] == 's' && !strcmp(s, "same")) {
+ if (!last)
+ usage_msg("same needs previous node specification");
+ s = last;
+ } else {
+ last = s;
+ }
+ return numa_parse_nodestring(s);
+}
+
int main(int ac, char **av)
{
int c, i, nnodes=0;
@@ -386,7 +400,7 @@ int main(int ac, char **av)
exit(0);
case 'i': /* --interleave */
checknuma();
- mask = numa_parse_nodestring(optarg);
+ mask = numactl_parse_nodestring(optarg);
if (!mask) {
printf ("<%s> is invalid\n", optarg);
usage();
@@ -404,7 +418,7 @@ int main(int ac, char **av)
case 'c': /* --cpubind */
dontshm("-c/--cpubind/--cpunodebind");
checknuma();
- mask = numa_parse_nodestring(optarg);
+ mask = numactl_parse_nodestring(optarg);
if (!mask) {
printf ("<%s> is invalid\n", optarg);
usage();
@@ -435,7 +449,7 @@ int main(int ac, char **av)
case 'm': /* --membind */
checknuma();
setpolicy(MPOL_BIND);
- mask = numa_parse_nodestring(optarg);
+ mask = numactl_parse_nodestring(optarg);
if (!mask) {
printf ("<%s> is invalid\n", optarg);
usage();
@@ -453,7 +467,7 @@ int main(int ac, char **av)
case 'p': /* --preferred */
checknuma();
setpolicy(MPOL_PREFERRED);
- mask = numa_parse_nodestring(optarg);
+ mask = numactl_parse_nodestring(optarg);
if (!mask) {
printf ("<%s> is invalid\n", optarg);
usage();
next reply other threads:[~2011-12-14 19:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-14 19:38 Andi Kleen [this message]
2011-12-14 19:38 ` [PATCH 2/8] Use constructors for numa_init/exit Andi Kleen
2011-12-14 19:38 ` [PATCH 3/8] Use glibc syscall if possible Andi Kleen
2011-12-14 19:38 ` [PATCH 4/8] Run full test suite before exiting Andi Kleen
2011-12-14 19:38 ` [PATCH 5/8] Add IO affinity support to libnuma Andi Kleen
2011-12-14 19:38 ` [PATCH 6/8] Clean regression test temp files Andi Kleen
2011-12-14 19:38 ` [PATCH 7/8] memhog: add option to disable transparent huge pages Andi Kleen
2011-12-14 19:38 ` [PATCH 8/8] Disable transparent huge pages in test suite Andi Kleen
2011-12-19 15:12 ` numactl/libnuma 2.0.8-rc3 Cliff Wickman
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=1323891518-1493-1-git-send-email-andi@firstfloor.org \
--to=andi@firstfloor.org \
--cc=ak@linux.intel.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 NNTP newsgroup(s).