dm-crypt: add the optional "high_priority" flag
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 8 Apr 2024 19:36:56 +0000 (21:36 +0200)
committerMike Snitzer <snitzer@kernel.org>
Tue, 16 Apr 2024 15:34:47 +0000 (11:34 -0400)
commit5268de78e1e61c828174cb2ac7d9c566a97cce69
treeffe0ac0469daeec112acb98f6f664e22187ac295
parent48ef0ba12e6b77a1ce5d09c580c38855b090ae7c
dm-crypt: add the optional "high_priority" flag

When WQ_HIGHPRI was used for the dm-crypt kcryptd workqueue it was
reported that dm-crypt performs badly when the system is loaded[1].
Because of reports of audio skipping, dm-crypt stopped using
WQ_HIGHPRI with commit f612b2132db5 (Revert "dm crypt: use WQ_HIGHPRI
for the IO and crypt workqueues").

But it has since been determined that WQ_HIGHPRI provides improved
performance (with reduced latency) for highend systems with much more
resources than those laptop/desktop users which suffered from the use
of WQ_HIGHPRI.

As such, add an option "high_priority" that allows the use of
WQ_HIGHPRI for dm-crypt's workqueues and also sets the write_thread to
nice level MIN_NICE (-20). This commit makes it optional, so that
normal users won't be harmed by it.

[1] https://listman.redhat.com/archives/dm-devel/2023-February/053410.html

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Documentation/admin-guide/device-mapper/dm-crypt.rst
drivers/md/dm-crypt.c