[PATCH] eal/windows: set pthread affinity

Menon, Ranjit ranjit.menon at intel.com
Wed Jan 26 19:41:24 CET 2022


On 1/20/2022 4:17 PM, Pallavi Kadam wrote:
> Sometimes OS tries to switch the core. So, bind the lcore thread
> to a fixed core.
> Implement affinity call on Windows similar to Linux.
>
> Signed-off-by: Qiao Liu<qiao.liu at intel.com>
> Signed-off-by: Pallavi Kadam<pallavi.kadam at intel.com>
> ---
>   lib/eal/windows/eal.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
> index 67db7f099a..ca3c41aaa7 100644
> --- a/lib/eal/windows/eal.c
> +++ b/lib/eal/windows/eal.c
> @@ -422,6 +422,10 @@ rte_eal_init(int argc, char **argv)
>   		/* create a thread for each lcore */
>   		if (eal_thread_create(&lcore_config[i].thread_id) != 0)
>   			rte_panic("Cannot create thread\n");
> +		ret = pthread_setaffinity_np(lcore_config[i].thread_id,
> +			sizeof(rte_cpuset_t), &lcore_config[i].cpuset);
> +		if (ret != 0)
> +			RTE_LOG(DEBUG, EAL, "Cannot set affinity\n");
>   	}
>   
>   	/* Initialize services so drivers can register services during probe. */

Acked-by: Ranjit Menon <ranjit.menon at intel.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20220126/aa3dd245/attachment.htm>


More information about the dev mailing list