DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pallavi Kadam <pallavi.kadam@intel.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, ranjit.menon@intel.com,
	dmitry.kozliuk@gmail.com, Narcisa.Vasile@microsoft.com,
	qiao.liu@intel.com, pallavi.kadam@intel.com
Subject: [PATCH] eal/windows: set pthread affinity
Date: Thu, 20 Jan 2022 16:17:49 -0800	[thread overview]
Message-ID: <20220121001749.458-1-pallavi.kadam@intel.com> (raw)

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


             reply	other threads:[~2022-01-20 23:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21  0:17 Pallavi Kadam [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220121001749.458-1-pallavi.kadam@intel.com \
    --to=pallavi.kadam@intel.com \
    --cc=Narcisa.Vasile@microsoft.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=qiao.liu@intel.com \
    --cc=ranjit.menon@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).