summarylogtreecommitdiffstats
path: root/0029-ZEN-INTERACTIVE-dm-crypt-Disable-workqueues-for-cryp.patch
blob: 7f3c9554db69ad094f86783bcb56ed8f8b2861f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Steven Barrett <steven@liquorix.net>
Date: Sat, 21 May 2022 15:15:09 -0500
Subject: [PATCH] ZEN: INTERACTIVE: dm-crypt: Disable workqueues for crypto ops

Queueing in dm-crypt for crypto operations reduces performance on modern
systems.  As discussed in an article from Cloudflare, they discovered
that queuing was introduced because the crypto subsystem used to be
synchronous.  Since it's now asynchronous, we get double queueing when
using the subsystem through dm-crypt.  This is obviously undesirable and
reduces throughput and increases latency.

Disable queueing when using our Zen Interactive configuration.

Fixes: https://github.com/zen-kernel/zen-kernel/issues/282
---
 drivers/md/dm-crypt.c | 5 +++++
 init/Kconfig          | 1 +
 2 files changed, 6 insertions(+)

diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 159c6806c19b8991fdcf33121f6c130fa1882f7f..f092d69da90afc8d429355c59bbdb60eb9d8a476 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -3137,6 +3137,11 @@ static int crypt_ctr_optional(struct dm_target *ti, unsigned int argc, char **ar
 		}
 	}
 
+#ifdef CONFIG_ZEN_INTERACTIVE
+	set_bit(DM_CRYPT_NO_READ_WORKQUEUE, &cc->flags);
+	set_bit(DM_CRYPT_NO_WRITE_WORKQUEUE, &cc->flags);
+#endif
+
 	return 0;
 }
 
diff --git a/init/Kconfig b/init/Kconfig
index a949de64fd4a73543722c96aaa9c7e534bb4c26a..ebc418581f41d0816c76981b3fa5f4d9306ded98 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -126,6 +126,7 @@ config ZEN_INTERACTIVE
 
 	    Default scheduler for SQ..: mq-deadline -> bfq
 	    Default scheduler for MQ..:        none -> kyber
+	    DM-Crypt Workqueues.......:          on -> off
 
 	  --- Virtual Memory Subsystem ---------------------------