summaryrefslogtreecommitdiffhomepage
path: root/src/send.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-06-16 02:23:42 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-06-16 04:40:16 +0200
commit8186537ff6272a5533e4dcf4b1b428d9328bed44 (patch)
tree92471a58662137a7122f38fd8ea0c7148dabda42 /src/send.c
parenta63830c6bbbf251765a5caee4111835048665f23 (diff)
queueing: re-enable preemption periodically to lower latency
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/send.c')
-rw-r--r--src/send.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/send.c b/src/send.c
index 5151466..e97e439 100644
--- a/src/send.c
+++ b/src/send.c
@@ -256,6 +256,12 @@ void packet_encrypt_worker(struct work_struct *work)
}
}
queue_enqueue_per_peer(&PACKET_PEER(first)->tx_queue, first, state);
+
+ /* Don't totally kill scheduling latency by keeping preemption disabled forever. */
+ if (have_simd && need_resched()) {
+ chacha20poly1305_deinit_simd(have_simd);
+ have_simd = chacha20poly1305_init_simd();
+ }
}
chacha20poly1305_deinit_simd(have_simd);
}