RDMA/siw: Relax from kmap_atomic() use in TX path
authorBernard Metzler <bmt@zurich.ibm.com>
Mon, 9 Sep 2019 13:29:45 +0000 (15:29 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 13 Sep 2019 19:59:55 +0000 (16:59 -0300)
Since the transmit path is never executed in an atomic context, we do not
need kmap_atomic() and can always use less demanding kmap().

Link: https://lore.kernel.org/r/20190909132945.30462-1-bmt@zurich.ibm.com
Signed-off-by: Bernard Metzler <bmt@zurich.ibm.com>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/sw/siw/siw_qp_tx.c

index 8e72f955921dca7f20194ab8a562688e496fd29f..5d97bba0ce6d485bde29bbb448332e51ec9f3a00 100644 (file)
@@ -76,16 +76,15 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)
                        if (unlikely(!p))
                                return -EFAULT;
 
-                       buffer = kmap_atomic(p);
+                       buffer = kmap(p);
 
                        if (likely(PAGE_SIZE - off >= bytes)) {
                                memcpy(paddr, buffer + off, bytes);
-                               kunmap_atomic(buffer);
                        } else {
                                unsigned long part = bytes - (PAGE_SIZE - off);
 
                                memcpy(paddr, buffer + off, part);
-                               kunmap_atomic(buffer);
+                               kunmap(p);
 
                                if (!mem->is_pbl)
                                        p = siw_get_upage(mem->umem,
@@ -97,11 +96,10 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)
                                if (unlikely(!p))
                                        return -EFAULT;
 
-                               buffer = kmap_atomic(p);
-                               memcpy(paddr + part, buffer,
-                                      bytes - part);
-                               kunmap_atomic(buffer);
+                               buffer = kmap(p);
+                               memcpy(paddr + part, buffer, bytes - part);
                        }
+                       kunmap(p);
                }
        }
        return (int)bytes;