linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] Add support for a "same" numamask  to numactl
@ 2011-12-14 19:38 Andi Kleen
  2011-12-14 19:38 ` [PATCH 2/8] Use constructors for numa_init/exit Andi Kleen
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Andi Kleen @ 2011-12-14 19:38 UTC (permalink / raw)
  To: cpw; +Cc: linux-numa, Andi Kleen

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-12-19 15:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-14 19:38 [PATCH 1/8] Add support for a "same" numamask to numactl Andi Kleen
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

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