cyclictest: touch threadstacks on numa to pre-fault them
PATCH 1/1 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 <[email protected]>
--- src/cyclictest/cyclictest.c | 3 +++ 1 file changed, 3 insertions(+)
src/cyclictest/cyclictest.c +3 -0
@@ -2376,6 +2376,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",
Signature · 1 line
2.9.3
Quoted 28 lines · Clark Williams
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 <[email protected]>--- src/cyclictest/cyclictest.c | 3 +++ 1 file changed, 3 insertions(+)src/cyclictest/cyclictest.c +3
-0@@ -2376,6 +2376,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",Signature · 3 lines
2.9.3 --
Signed-off-by John Kacur <[email protected]>