OSDN Git Service

fscrypt: use unbound workqueue for decryption
[android-x86/kernel.git] / fs / crypto / crypto.c
index 73de144..1a89625 100644 (file)
@@ -517,8 +517,17 @@ EXPORT_SYMBOL(fscrypt_initialize);
  */
 static int __init fscrypt_init(void)
 {
+       /*
+        * Use an unbound workqueue to allow bios to be decrypted in parallel
+        * even when they happen to complete on the same CPU.  This sacrifices
+        * locality, but it's worthwhile since decryption is CPU-intensive.
+        *
+        * Also use a high-priority workqueue to prioritize decryption work,
+        * which blocks reads from completing, over regular application tasks.
+        */
        fscrypt_read_workqueue = alloc_workqueue("fscrypt_read_queue",
-                                                       WQ_HIGHPRI, 0);
+                                                WQ_UNBOUND | WQ_HIGHPRI,
+                                                num_online_cpus());
        if (!fscrypt_read_workqueue)
                goto fail;