Skip to content

Commit

Permalink
will-it-scale: update package and add affinity parameter
Browse files Browse the repository at this point in the history
Old will-it-scale will by default do the CPU bindings for all
running tasks, and this will hurt the test scenario of running
will-it-scale in differenct control groups. Say, we start 4
cgroups that each runs 32 tasks, with current package, all
cgroups will bind their tasks to the same 32 CPUs, so only 32
CPUs of the tbox will be busy, while others are mostly idle.

So update to the new package which supports disabling CPU-task
bindings, and add a parameter 'no_affinity' to enable it.

Be default, the test behaves just like before, while user can
disable CPU binding with 'no_affinity' parameter.

Signed-off-by: Feng Tang <[email protected]>
Acked-by: "Huang, Ying" <[email protected]>
Signed-off-by: Philip Li <[email protected]>
  • Loading branch information
ftang1 authored and rli9 committed Nov 25, 2021
1 parent ecd2056 commit b322c19
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
28 changes: 18 additions & 10 deletions pkg/will-it-scale/will-it-scale.patch
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
From b941867b04f90ccdd618e80848cc14a9db4f7c04 Mon Sep 17 00:00:00 2001
From c15900e2ec8854bc2115ce8a6c54aeaec3b31ed6 Mon Sep 17 00:00:00 2001
From: root <[email protected]>
Date: Thu, 21 May 2020 12:50:09 +0800
Date: Wed, 24 Nov 2021 18:50:35 +0800
Subject: [PATCH] update runtest.py

* 2021/11, add 'affinity' parameter

Signed-off-by: root <[email protected]>
Signed-off-by: Feng Tang <[email protected]>
---
runtest.py | 82 +++++++++++++++++++++++++++++++-------------------------------
1 file changed, 41 insertions(+), 41 deletions(-)
runtest.py | 87 +++++++++++++++++++++++++++++-------------------------
1 file changed, 46 insertions(+), 41 deletions(-)

diff --git a/runtest.py b/runtest.py
index 8bda393..de4271a 100755
index 8bda393..395e952 100755
--- a/runtest.py
+++ b/runtest.py
@@ -48,12 +48,13 @@ class linux_stat():
@@ -48,12 +48,18 @@ class linux_stat():
return 1.0 * idle / (idle + busy)


Expand All @@ -27,10 +30,15 @@ index 8bda393..de4271a 100755
+duration = int(sys.argv[2])
+mode = sys.argv[3]
+threads = sys.argv[4:]
+
+# Optional feature for "-n" option, which will disable cpu bindings for test tasks
+affinity = " "
+if len(sys.argv) == 6:
+ affinity = sys.argv[5]

nr_cores=0
r = re.compile('^processor')
@@ -87,43 +88,42 @@ if arch == 'ppc64':
@@ -87,43 +93,42 @@ if arch == 'ppc64':
print('tasks,processes,processes_idle,threads,threads_idle,linear')
print('0,0,100,0,100,0')

Expand Down Expand Up @@ -77,7 +85,7 @@ index 8bda393..de4271a 100755
+ processes_avg = 0
+ processes_idle = 0
+ if mode == 'process' or mode == 'both':
+ c = './%s_processes -t %d -s %d' % (cmd, i, duration)
+ c = './%s_processes -t %d -s %d %s ' % (cmd, i, duration, affinity)
+ before = linux_stat()
+ pipe = subprocess.Popen(setarch + ' ' + c, shell=True, stdout=subprocess.PIPE, text=True).stdout
+ for line in pipe.readlines():
Expand All @@ -97,7 +105,7 @@ index 8bda393..de4271a 100755
+ threads_avg = 0
+ threads_idle = 0
+ if mode == 'thread' or mode == 'both':
+ c = './%s_threads -t %d -s %d' % (cmd, i, duration)
+ c = './%s_threads -t %d -s %d %s ' % (cmd, i, duration, affinity)
+ before = linux_stat()
+ pipe = subprocess.Popen(setarch + ' ' + c, shell=True, stdout=subprocess.PIPE, text=True).stdout
+ for line in pipe.readlines():
Expand All @@ -111,5 +119,5 @@ index 8bda393..de4271a 100755
if i == 1:
linear = max(processes_avg, threads_avg)
--
2.11.0
2.27.0

6 changes: 5 additions & 1 deletion tests/will-it-scale
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# - test
# - mode
# - nr_task
# - no_affinity /* Do not do the CPU bindings for test tasks */

## It Scale takes a testcase and runs it from 1 through to n
## parallel copies to see if the testcase will scale. It
Expand Down Expand Up @@ -32,6 +33,9 @@ else
setup_params
fi

affinity_config=" "
[ -n "$no_affinity" ] && affinity_config=" -n "

ulimit -n 65536

log_cmd /lkp/benchmarks/python3/bin/python3 ./runtest.py $test $duration $mode $threads_to_iterate
log_cmd /lkp/benchmarks/python3/bin/python3 ./runtest.py $test $duration $mode $threads_to_iterate $affinity_config

0 comments on commit b322c19

Please sign in to comment.