summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/sdu_sched.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-04-02 08:19:54 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2018-04-05 10:31:52 +0200
commit3b03c4b2bcbcf5a913a3127d2b45283540c505c3 (patch)
treefc18ab41a741f7d6ce3b05145558a1cf83c422f8 /src/ipcpd/normal/sdu_sched.c
parentb81d5a327d272db9b511217665b5febceccb725d (diff)
downloadouroboros-3b03c4b2bcbcf5a913a3127d2b45283540c505c3.tar.gz
ouroboros-3b03c4b2bcbcf5a913a3127d2b45283540c505c3.zip
ipcpd: Enable locking threads to a CPU core
This adds a function that locks a thread to a random core. This greatly improves performance on multi-cpu systems. There is no portable way to do this, this only implements it for GNU/Linux. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/ipcpd/normal/sdu_sched.c')
-rw-r--r--src/ipcpd/normal/sdu_sched.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ipcpd/normal/sdu_sched.c b/src/ipcpd/normal/sdu_sched.c
index d4826ce5..56455721 100644
--- a/src/ipcpd/normal/sdu_sched.c
+++ b/src/ipcpd/normal/sdu_sched.c
@@ -20,12 +20,13 @@
* Foundation, Inc., http://www.fsf.org/about/contact/.
*/
-#define _POSIX_C_SOURCE 199309L
+#define _POSIX_C_SOURCE 200112L
#include "config.h"
#include <ouroboros/errno.h>
+#include "ipcp.h"
#include "sdu_sched.h"
#include <assert.h>
@@ -67,6 +68,8 @@ static void * sdu_reader(void * o)
sched = ((struct sched_info *) o)->sch;
qc = ((struct sched_info *) o)->qc;
+ ipcp_lock_to_core();
+
free(o);
fq = fqueue_create();