smb3: only offload decryption of read responses if multiple requests
authorSteve French <stfrench@microsoft.com>
Mon, 9 Sep 2019 18:30:15 +0000 (13:30 -0500)
committerSteve French <stfrench@microsoft.com>
Mon, 16 Sep 2019 16:43:38 +0000 (11:43 -0500)
No point in offloading read decryption if no other requests on the
wire

Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
fs/cifs/cifsfs.c
fs/cifs/smb2ops.c

index ebf85a5d95e4e57d308fa6259ee108dc46a1f53d..c1b6850720635c9e16f07596f0cd3e2a725ceddf 100644 (file)
@@ -1503,11 +1503,14 @@ init_cifs(void)
        }
 
        /*
-        * BB Consider setting limit!=0 maybe to min(num_of_cores - 1, 3) so we
-        * don't launch too many worker threads
+        * Consider in future setting limit!=0 maybe to min(num_of_cores - 1, 3)
+        * so that we don't launch too many worker threads but
+        * Documentation/workqueue.txt recommends setting it to 0
         */
+
+       /* WQ_UNBOUND allows decrypt tasks to run on any CPU */
        decrypt_wq = alloc_workqueue("smb3decryptd",
-                                    WQ_FREEZABLE|WQ_MEM_RECLAIM, 0);
+                                    WQ_UNBOUND|WQ_FREEZABLE|WQ_MEM_RECLAIM, 0);
        if (!decrypt_wq) {
                rc = -ENOMEM;
                goto out_destroy_cifsiod_wq;
index 1cfb8d51813272cce8ef29c2a9f785cb682dc480..72b3e39d7f4f773d17bfe228afc69e9ecbeddeda 100644 (file)
@@ -4121,7 +4121,7 @@ receive_encrypted_read(struct TCP_Server_Info *server, struct mid_q_entry **mid,
         * use more cores decrypting which can be expensive
         */
 
-       if ((server->min_offload) &&
+       if ((server->min_offload) && (server->in_flight > 1) &&
            (server->pdu_size >= server->min_offload)) {
                dw = kmalloc(sizeof(struct smb2_decrypt_work), GFP_KERNEL);
                if (dw == NULL)