linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] follow-up patches for new --all option
@ 2013-09-10 13:13 Petr Holasek
  2013-09-10 13:13 ` [PATCH 1/2] libnuma: new function numa_run_on_node_mask_all added to library manpage Petr Holasek
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Petr Holasek @ 2013-09-10 13:13 UTC (permalink / raw)
  To: Cliff Wickman; +Cc: Andi Kleen, linux-numa, Petr Holasek

Hi all,

Following two patches add description of new numa_run_on_node_mask all function
to library manpage and unit test for regression testsuite.

Patches are on top of 2.0.9-rc4.

thanks,
Petr

Petr Holasek (2):
  libnuma: new function numa_run_on_node_mask_all added to library
    manpage
  libnuma: added regression test for new --all option

 numa.3          |  12 ++++++-
 test/bind_range | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 test/regress2   |   1 +
 3 files changed, 116 insertions(+), 1 deletion(-)
 create mode 100755 numactl-2.0.9-rc4/test/bind_range

-- 
1.8.1.4

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

* [PATCH 1/2] libnuma: new function numa_run_on_node_mask_all added to library manpage
  2013-09-10 13:13 [PATCH 0/2] follow-up patches for new --all option Petr Holasek
@ 2013-09-10 13:13 ` Petr Holasek
  2013-09-10 13:13 ` [PATCH 2/2] libnuma: added regression test for new --all option Petr Holasek
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Petr Holasek @ 2013-09-10 13:13 UTC (permalink / raw)
  To: Cliff Wickman; +Cc: Andi Kleen, linux-numa, Petr Holasek

---
 numa.3 | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/numa.3 b/numa.3
index 6011168..52b03c4 100755
--- a/numa.3
+++ b/numa.3
@@ -99,6 +99,8 @@ numa \- NUMA policy library
 .br
 .BI "int numa_run_on_node_mask(struct bitmask *" nodemask );
 .br
+.BI "int numa_run_on_node_mask_all(struct bitmask *" nodemask );
+.br
 .B struct bitmask *numa_get_run_node_mask(void);
 .sp
 .BI "void numa_tonode_memory(void *" start ", size_t " size ", int " node );
@@ -233,7 +235,8 @@ The exceptions to this are:
 .IR numa_node_of_cpu (),
 .IR numa_bind (),
 .IR numa_run_on_node (),
-.IR numa_run_on_node_mask ()
+.IR numa_run_on_node_mask (),
+.IR numa_run_on_node_mask_all (),
 and
 .IR numa_get_run_node_mask ().
 These functions deal with the CPUs associated with numa nodes.
@@ -686,6 +689,13 @@ On success, 0 is returned; on error \-1 is returned, and
 .I errno
 is set to indicate the error.
 
+.BR numa_run_on_node_mask_all ()
+runs the current task and its children only on nodes specified in
+.IR nodemask
+like
+.I numa_run_on_node_mask
+but without any cpuset awareness.
+
 .BR numa_get_run_node_mask ()
 returns a mask of CPUs on which the current task is allowed to run.
 
-- 
1.8.1.4

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

* [PATCH 2/2] libnuma: added regression test for new --all option
  2013-09-10 13:13 [PATCH 0/2] follow-up patches for new --all option Petr Holasek
  2013-09-10 13:13 ` [PATCH 1/2] libnuma: new function numa_run_on_node_mask_all added to library manpage Petr Holasek
@ 2013-09-10 13:13 ` Petr Holasek
  2013-09-10 17:56 ` [PATCH 0/2] follow-up patches " Andi Kleen
  2013-09-10 18:25 ` Cliff Wickman
  3 siblings, 0 replies; 5+ messages in thread
From: Petr Holasek @ 2013-09-10 13:13 UTC (permalink / raw)
  To: Cliff Wickman; +Cc: Andi Kleen, linux-numa, Petr Holasek

---
 test/bind_range | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 test/regress2   |   1 +
 2 files changed, 105 insertions(+)

diff --git a/test/bind_range b/test/bind_range
new file mode 100755
index 0000000..8e0bc22
--- /dev/null
+++ b/test/bind_range
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+# This simple script checks --all/-a option which is used for
+# supressing of default cpuset awareness of options --cpunodebind,
+# --physcpubind, --interleave, --preferred and --membind.
+
+# NOTE: Test needs two nodes and two cpus at least
+
+
+export old_mask
+
+eval_test() {
+       echo "Running $1.."
+       $1
+       if [ $? == 1 ] ;  then
+          echo -e "$1 FAILED!"
+	  reset_mask
+          exit 1
+       fi
+       echo -e "$1 PASSED"
+}
+
+function check_arg_order
+{
+	numactl --all --physcpubind=$HIGHESTCPU ls > /dev/null 2>&1
+	if [ $? == 1 ] ; then
+		return 1;
+	fi
+	numactl --physcpubind=$HIGHESTCPU --all ls > /dev/null 2>&1
+	if [ $? == 0 ] ; then
+		return 1;
+	fi
+	
+	return 0
+}
+
+function check_physcpubind
+{
+	reset_mask
+	set_cpu_affinity 0
+	numactl --physcpubind=$HIGHESTCPU ls > /dev/null 2>&1
+	if [ $? == 0 ] ; then # shouldn't pass so easy
+		return 1;
+	fi
+	numactl --all --physcpubind=$HIGHESTCPU ls > /dev/null 2>&1
+	if [ $? == 1 ] ; then # shouldn't fail
+		return 1;
+	fi
+
+	return 0
+}
+
+function check_cpunodebind
+{
+	local low_cpu_range
+	local high_cpu
+
+	reset_mask
+	low_cpu_range=$(cat /sys/devices/system/node/node$LOWESTNODE/cpulist)
+	set_cpu_affinity $low_cpu_range
+	numactl --cpunodebind=$HIGHESTNODE ls > /dev/null 2>&1
+	if [ $? == 1 ] ; then # should pass
+		return 1;
+	fi
+	numactl --all --cpunodebind=$HIGHESTNODE ls > /dev/null 2>&1
+	if [ $? == 1 ] ; then # should pass for sure
+		return 1;
+	fi
+
+	return 0
+}
+
+function set_cpu_affinity
+{
+	taskset -p -c $1 $$ > /dev/null
+	#echo -e "\taffinity of shell was set to" $1
+}
+
+function get_mask
+{
+	old_mask=$(taskset -p $$ | cut -f2 -d: | sed -e 's/^[ \t]*//')
+}
+
+function reset_mask
+{
+	taskset -p $old_mask $$ > /dev/null
+	#echo -e "\taffinity of shell was reset to" $old_mask
+}
+
+HIGHESTCPU=$(grep 'processor' /proc/cpuinfo | tail -n1 | cut -f2 -d' ')
+HIGHESTNODE=$(numactl -H | grep -e 'node [0-9]* cpus' | tail -n1 | cut -f2 -d' ')
+LOWESTNODE=$(numactl -H | grep -e 'node [0-9]* cpus' | head -n1 | cut -f2 -d' ')
+
+get_mask
+
+eval_test check_arg_order
+eval_test check_physcpubind
+eval_test check_cpunodebind
+
+reset_mask
+
+exit 0
+
+
diff --git a/test/regress2 b/test/regress2
index b6a9211..d71f290 100755
--- a/test/regress2
+++ b/test/regress2
@@ -23,4 +23,5 @@ T ./nodemap
 T ./checkaffinity
 T ./checktopology
 T ./tbitmap
+T ./bind_range
 #T ./randmap
-- 
1.8.1.4

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

* Re: [PATCH 0/2] follow-up patches for new --all option
  2013-09-10 13:13 [PATCH 0/2] follow-up patches for new --all option Petr Holasek
  2013-09-10 13:13 ` [PATCH 1/2] libnuma: new function numa_run_on_node_mask_all added to library manpage Petr Holasek
  2013-09-10 13:13 ` [PATCH 2/2] libnuma: added regression test for new --all option Petr Holasek
@ 2013-09-10 17:56 ` Andi Kleen
  2013-09-10 18:25 ` Cliff Wickman
  3 siblings, 0 replies; 5+ messages in thread
From: Andi Kleen @ 2013-09-10 17:56 UTC (permalink / raw)
  To: Petr Holasek; +Cc: Cliff Wickman, Andi Kleen, linux-numa


Patches look good to me. Thanks.

-Andi

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

* Re: [PATCH 0/2] follow-up patches for new --all option
  2013-09-10 13:13 [PATCH 0/2] follow-up patches for new --all option Petr Holasek
                   ` (2 preceding siblings ...)
  2013-09-10 17:56 ` [PATCH 0/2] follow-up patches " Andi Kleen
@ 2013-09-10 18:25 ` Cliff Wickman
  3 siblings, 0 replies; 5+ messages in thread
From: Cliff Wickman @ 2013-09-10 18:25 UTC (permalink / raw)
  To: Petr Holasek; +Cc: Andi Kleen, linux-numa

Hi Petr,

On Tue, Sep 10, 2013 at 03:13:15PM +0200, Petr Holasek wrote:
> Hi all,
> 
> Following two patches add description of new numa_run_on_node_mask all function
> to library manpage and unit test for regression testsuite.
> 
> Patches are on top of 2.0.9-rc4.

Okay thanks.  
I tested on medium sized x86_64 and ia64 systems.

These two are applied and published in 2.0.9-rc5.

-Cliff
> 
> Petr Holasek (2):
>   libnuma: new function numa_run_on_node_mask_all added to library
>     manpage
>   libnuma: added regression test for new --all option
> 
>  numa.3          |  12 ++++++-
>  test/bind_range | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  test/regress2   |   1 +
>  3 files changed, 116 insertions(+), 1 deletion(-)
>  create mode 100755 numactl-2.0.9-rc4/test/bind_range
> 
> -- 
> 1.8.1.4

-- 
Cliff Wickman
SGI
cpw@sgi.com
(651) 683-3824

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

end of thread, other threads:[~2013-09-10 18:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-10 13:13 [PATCH 0/2] follow-up patches for new --all option Petr Holasek
2013-09-10 13:13 ` [PATCH 1/2] libnuma: new function numa_run_on_node_mask_all added to library manpage Petr Holasek
2013-09-10 13:13 ` [PATCH 2/2] libnuma: added regression test for new --all option Petr Holasek
2013-09-10 17:56 ` [PATCH 0/2] follow-up patches " Andi Kleen
2013-09-10 18:25 ` 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).