summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClark Williams <williams@redhat.com>2017-04-24 12:05:15 -0500
committerJohn Kacur <jkacur@redhat.com>2017-04-24 21:51:31 +0200
commit193ed3d12ebe20817ac19a53a8f87c992283dda1 (patch)
tree2345592f3a6286cdf92b91d1bdb56b6957b291b3
parent9d2c9edd86943dfea399a0176826af8bb92bf97c (diff)
downloadrt-tests-193ed3d12ebe20817ac19a53a8f87c992283dda1.tar.gz
cyclictest: touch threadstacks on numa to pre-fault them
On a numa system we allocate a stack from the closest NUMA node for each measurement thread. We need to touch those stack pages to prevent them faulting when first run. Not a big deal on a system with just a few cores, but overhead adds up with 32+ cores. Signed-off-by: Clark Williams <williams@redhat.com> Signed-off-by: John Kacur <jkacur@redhat.com>
-rw-r--r--src/cyclictest/cyclictest.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 0b13441..48791c1 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -2377,6 +2377,9 @@ int main(int argc, char **argv)
/* allocate memory for a stack on appropriate node */
stack = rt_numa_numa_alloc_onnode(stksize, node, i);
+ /* touch the stack pages to pre-fault them in */
+ memset(stack, 0, stksize);
+
/* set the thread's stack */
if (pthread_attr_setstack(&attr, stack, stksize))
fatal("failed to set stack addr for thread %d to 0x%x\n",