Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm crypt: use WQ_HIGHPRI for the IO and crypt workqueues

Running dm-crypt with workqueues at the standard priority results in IO
competing for CPU time with standard user apps, which can lead to
pipeline bubbles and seriously degraded performance. Move to using
WQ_HIGHPRI workqueues to protect against that.

Signed-off-by: Tim Murray <timmurray@google.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>

authored by

Tim Murray and committed by
Mike Snitzer
a1b89132 c82feeec

+4 -3
+4 -3
drivers/md/dm-crypt.c
··· 2749 2749 } 2750 2750 2751 2751 ret = -ENOMEM; 2752 - cc->io_queue = alloc_workqueue("kcryptd_io", WQ_MEM_RECLAIM, 1); 2752 + cc->io_queue = alloc_workqueue("kcryptd_io", WQ_HIGHPRI | WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM, 1); 2753 2753 if (!cc->io_queue) { 2754 2754 ti->error = "Couldn't create kcryptd io queue"; 2755 2755 goto bad; 2756 2756 } 2757 2757 2758 2758 if (test_bit(DM_CRYPT_SAME_CPU, &cc->flags)) 2759 - cc->crypt_queue = alloc_workqueue("kcryptd", WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM, 1); 2759 + cc->crypt_queue = alloc_workqueue("kcryptd", WQ_HIGHPRI | WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM, 1); 2760 2760 else 2761 - cc->crypt_queue = alloc_workqueue("kcryptd", WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM | WQ_UNBOUND, 2761 + cc->crypt_queue = alloc_workqueue("kcryptd", 2762 + WQ_HIGHPRI | WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM | WQ_UNBOUND, 2762 2763 num_online_cpus()); 2763 2764 if (!cc->crypt_queue) { 2764 2765 ti->error = "Couldn't create kcryptd queue";