From a8a0d4b9f356610babe5b884500799310fe6dcdd Mon Sep 17 00:00:00 2001 From: Steven Barrett Date: Sat, 21 May 2022 15:15:09 -0500 Subject: 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(+) --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -3310,6 +3310,11 @@ static int crypt_ctr(struct dm_target *t goto bad; } +#ifdef CONFIG_ZEN_INTERACTIVE + set_bit(DM_CRYPT_NO_READ_WORKQUEUE, &cc->flags); + set_bit(DM_CRYPT_NO_WRITE_WORKQUEUE, &cc->flags); +#endif + ret = crypt_ctr_cipher(ti, argv[0], argv[1]); if (ret < 0) goto bad; --- a/init/Kconfig +++ b/init/Kconfig @@ -153,6 +153,7 @@ config ZEN_INTERACTIVE Default scheduler for SQ..: mq-deadline -> bfq Default scheduler for MQ..: none -> kyber + DM-Crypt workqueues.......: yes -> no --- Virtual Memory Subsystem ---------------------------