* [PATCH] eal/windows: set pthread affinity
@ 2022-01-21 0:17 Pallavi Kadam
2022-01-26 6:45 ` Narcisa Ana Maria Vasile
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Pallavi Kadam @ 2022-01-21 0:17 UTC (permalink / raw)
To: dev
Cc: thomas, ranjit.menon, dmitry.kozliuk, Narcisa.Vasile, qiao.liu,
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 <qiao.liu@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@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. */
--
2.31.1.windows.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] eal/windows: set pthread affinity
2022-01-21 0:17 [PATCH] eal/windows: set pthread affinity Pallavi Kadam
@ 2022-01-26 6:45 ` Narcisa Ana Maria Vasile
2022-01-26 18:41 ` Menon, Ranjit
2022-02-01 6:29 ` Tal Shnaiderman
2 siblings, 0 replies; 6+ messages in thread
From: Narcisa Ana Maria Vasile @ 2022-01-26 6:45 UTC (permalink / raw)
To: Pallavi Kadam
Cc: dev, thomas, ranjit.menon, dmitry.kozliuk, Narcisa.Vasile, qiao.liu
On Thu, Jan 20, 2022 at 04:17:49PM -0800, 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@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@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");
> }
>
Acked-by: Narcisa Vasile <navasile@linux.microsoft.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] eal/windows: set pthread affinity
2022-01-21 0:17 [PATCH] eal/windows: set pthread affinity Pallavi Kadam
2022-01-26 6:45 ` Narcisa Ana Maria Vasile
@ 2022-01-26 18:41 ` Menon, Ranjit
2022-02-01 6:29 ` Tal Shnaiderman
2 siblings, 0 replies; 6+ messages in thread
From: Menon, Ranjit @ 2022-01-26 18:41 UTC (permalink / raw)
To: Pallavi Kadam, dev; +Cc: thomas, dmitry.kozliuk, Narcisa.Vasile, qiao.liu
[-- Attachment #1: Type: text/plain, Size: 1060 bytes --]
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@intel.com>
> Signed-off-by: Pallavi Kadam<pallavi.kadam@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@intel.com>
[-- Attachment #2: Type: text/html, Size: 1679 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] eal/windows: set pthread affinity
2022-01-21 0:17 [PATCH] eal/windows: set pthread affinity Pallavi Kadam
2022-01-26 6:45 ` Narcisa Ana Maria Vasile
2022-01-26 18:41 ` Menon, Ranjit
@ 2022-02-01 6:29 ` Tal Shnaiderman
2022-02-01 7:52 ` Idan Hackmon
2 siblings, 1 reply; 6+ messages in thread
From: Tal Shnaiderman @ 2022-02-01 6:29 UTC (permalink / raw)
To: Pallavi Kadam, dev
Cc: NBU-Contact-Thomas Monjalon (EXTERNAL),
ranjit.menon, dmitry.kozliuk, Narcisa.Vasile, qiao.liu,
Idan Hackmon
> 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 <qiao.liu@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@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. */
> --
> 2.31.1.windows.1
Acked-by: Tal Shnaiderman <talshn@nvidia.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] eal/windows: set pthread affinity
2022-02-01 6:29 ` Tal Shnaiderman
@ 2022-02-01 7:52 ` Idan Hackmon
2022-02-02 22:45 ` Thomas Monjalon
0 siblings, 1 reply; 6+ messages in thread
From: Idan Hackmon @ 2022-02-01 7:52 UTC (permalink / raw)
To: Tal Shnaiderman, Pallavi Kadam, dev
Cc: NBU-Contact-Thomas Monjalon (EXTERNAL),
ranjit.menon, dmitry.kozliuk, Narcisa.Vasile, qiao.liu
> Subject: RE: [PATCH] eal/windows: set pthread affinity
>
> > 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 <qiao.liu@intel.com>
> > Signed-off-by: Pallavi Kadam <pallavi.kadam@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. */
> > --
> > 2.31.1.windows.1
>
> Acked-by: Tal Shnaiderman <talshn@nvidia.com>
Tested-by: Idan Hackmon <idanhac@nvidia.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] eal/windows: set pthread affinity
2022-02-01 7:52 ` Idan Hackmon
@ 2022-02-02 22:45 ` Thomas Monjalon
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2022-02-02 22:45 UTC (permalink / raw)
To: Pallavi Kadam, qiao.liu
Cc: Tal Shnaiderman, dev, ranjit.menon, dmitry.kozliuk,
Narcisa.Vasile, Idan Hackmon
> > > 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@intel.com>
> > > Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > Acked-by: Tal Shnaiderman <talshn@nvidia.com>
> Tested-by: Idan Hackmon <idanhac@nvidia.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-02 22:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21 0:17 [PATCH] eal/windows: set pthread affinity Pallavi Kadam
2022-01-26 6:45 ` Narcisa Ana Maria Vasile
2022-01-26 18:41 ` Menon, Ranjit
2022-02-01 6:29 ` Tal Shnaiderman
2022-02-01 7:52 ` Idan Hackmon
2022-02-02 22:45 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).