Re: [PATCH] cyclictest: touch threadstacks on numa to pre-fault them

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, 24 Apr 2017, Clark Williams wrote:

> 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@xxxxxxxxxx>
> ---
>  src/cyclictest/cyclictest.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index 5e23fc58f602..49a81f168cdb 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -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",
> -- 
> 2.9.3
> 
> --

Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux