eal/windows: set pthread affinity
PATCH 1/1 eal/windows: set pthread affinity
Sometimes OS tries to switch the core. So, bind the lcore thread to a fixed core.
Implement affinity call on Windows similar to Linux.
--- lib/eal/windows/eal.c | 4 ++++ 1 file changed, 4 insertions(+)
lib/eal/windows/eal.c +4 -0
@@ -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. */
Signature · 1 line
2.31.1.windows.1
Quoted 15 lines · Pallavi Kadam
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 <[email protected]>Signed-off-by Pallavi Kadam <[email protected]>--- lib/eal/windows/eal.c | 4 ++++ 1 file changed, 4 insertions(+)lib/eal/windows/eal.c +0
-0
lib/eal/windows/eal.c rte_eal_init(int argc, char **argv) · line 430
Quoted 9 lines
lib/eal/windows/eal.c +4
-0@@ -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" ); }
Quoted 15 lines · Pallavi Kadam
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<[email protected]>Signed-off-by Pallavi Kadam<[email protected]>--- lib/eal/windows/eal.c | 4 ++++ 1 file changed, 4 insertions(+)lib/eal/windows/eal.c +0
-0
lib/eal/windows/eal.c rte_eal_init(int argc, char **argv) · line 431
Quoted 10 lines
lib/eal/windows/eal.c +4
-0@@ -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. */
Quoted 31 lines
Subject: [PATCH] eal/windows: set pthread affinity
External email: Use caution opening links or attachments
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 <[email protected]>Signed-off-by Pallavi Kadam <[email protected]>--- lib/eal/windows/eal.c | 4 ++++ 1 file changed, 4 insertions(+)lib/eal/windows/eal.c index renamed from lib/eal/windows/eal.c +0
-0
67db7f099a..ca3c41aaa7100644lib/eal/windows/eal.c +4
-1@@ -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. */ --
Quoted 1 line
2.31.1.windows.1
Idan Hackmon
Tested-byQuoted 31 lines
Subject: RE: [PATCH] eal/windows: set pthread affinity
Quoted 29 lines
Subject: [PATCH] eal/windows: set pthread affinity
External email: Use caution opening links or attachments
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 <[email protected]>Signed-off-by Pallavi Kadam <[email protected]>--- lib/eal/windows/eal.c | 4 ++++ 1 file changed, 4 insertions(+)lib/eal/windows/eal.c index renamed from lib/eal/windows/eal.c +0
-0
67db7f099a..ca3c41aaa7100644lib/eal/windows/eal.c +4
-0@@ -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" ); }
Quoted 6 lines
Quoted 4 lines
lib/eal/windows/eal.c +0
-0/* Initialize services so drivers can register services during probe. */
--
2.31.1.windows.1Acked-by Tal Shnaiderman <[email protected]>
Thomas Monjalon
AppliedQuoted 8 lines
Quoted 7 lines
Quoted 6 lines
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 <[email protected]>Signed-off-by Pallavi Kadam <[email protected]>Acked-by Tal Shnaiderman <[email protected]>Tested-by Idan Hackmon <[email protected]>
Applied, thanks.