From 193ed3d12ebe20817ac19a53a8f87c992283dda1 Mon Sep 17 00:00:00 2001 From: Clark Williams Date: Mon, 24 Apr 2017 12:05:15 -0500 Subject: 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 Signed-off-by: John Kacur --- src/cyclictest/cyclictest.c | 3 +++ 1 file changed, 3 insertions(+) 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", -- cgit 1.2.3-korg