From 3b03c4b2bcbcf5a913a3127d2b45283540c505c3 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Mon, 2 Apr 2018 08:19:54 +0200 Subject: 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 Signed-off-by: Sander Vrijders --- src/ipcpd/udp/main.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ipcpd/udp') diff --git a/src/ipcpd/udp/main.c b/src/ipcpd/udp/main.c index ba613150..be7491f4 100644 --- a/src/ipcpd/udp/main.c +++ b/src/ipcpd/udp/main.c @@ -470,6 +470,8 @@ static void * ipcp_udp_sdu_reader(void * o) (void) o; + ipcp_lock_to_core(); + while (true) { pthread_rwlock_rdlock(&udp_data.flows_lock); pthread_mutex_lock(&udp_data.fd_set_lock); @@ -518,6 +520,8 @@ static void * ipcp_udp_sdu_loop(void * o) (void) o; + ipcp_lock_to_core(); + while (true) { fevent(udp_data.np1_flows, udp_data.fq, NULL); while ((fd = fqueue_next(udp_data.fq)) >= 0) { -- cgit v1.2.3