All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kni: add module parameter 'bind_to_core'
@ 2016-08-16 18:24 Vladyslav Buslov
  2016-08-25 14:46 ` Ferruh Yigit
  0 siblings, 1 reply; 4+ messages in thread
From: Vladyslav Buslov @ 2016-08-16 18:24 UTC (permalink / raw)
  To: ferruh.yigit; +Cc: dev

Allow binding KNI thread to specific core in single threaded mode.

Signed-off-by: Vladyslav Buslov <vladyslav.buslov@harmonicinc.com>
---
 lib/librte_eal/linuxapp/kni/kni_misc.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c
index 59d15ca..e98f4a9 100644
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -93,6 +93,7 @@ static char *lo_mode = NULL;
 /* Kernel thread mode */
 static char *kthread_mode = NULL;
 static unsigned multiple_kthread_on = 0;
+static int bind_to_core = -1;
 
 #define KNI_DEV_IN_USE_BIT_NUM 0 /* Bit number for device in use */
 
@@ -239,12 +240,17 @@ kni_open(struct inode *inode, struct file *file)
 	if (multiple_kthread_on == 0) {
 		KNI_PRINT("Single kernel thread for all KNI devices\n");
 		/* Create kernel thread for RX */
-		knet->kni_kthread = kthread_run(kni_thread_single, (void *)knet,
+		knet->kni_kthread = kthread_create(kni_thread_single, (void *)knet,
 						"kni_single");
 		if (IS_ERR(knet->kni_kthread)) {
 			KNI_ERR("Unable to create kernel threaed\n");
 			return PTR_ERR(knet->kni_kthread);
 		}
+		if (bind_to_core >= 0) {
+			KNI_PRINT("Bind main thread to core %d\n", bind_to_core);
+			kthread_bind(knet->kni_kthread, bind_to_core);
+		}
+		wake_up_process(knet->kni_kthread);
 	} else
 		KNI_PRINT("Multiple kernel thread mode enabled\n");
 
@@ -698,3 +704,8 @@ MODULE_PARM_DESC(kthread_mode,
 "    multiple  Multiple kernel thread mode enabled.\n"
 "\n"
 );
+
+module_param(bind_to_core, int, S_IRUGO);
+MODULE_PARM_DESC(bind_to_core,
+"Bind KNI main kernel thread to specific core (default=-1(disabled)):\n"
+);
\ No newline at end of file
-- 
2.8.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-02 15:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-16 18:24 [PATCH] kni: add module parameter 'bind_to_core' Vladyslav Buslov
2016-08-25 14:46 ` Ferruh Yigit
2016-08-28 11:20   ` Vladyslav Buslov
2016-09-02 15:13   ` [PATCH] kni: add support for core_id param in single threaded mode Vladyslav Buslov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.