xprtrdma: Reduce per-transport MR allocation
authorChuck Lever <chuck.lever@oracle.com>
Tue, 26 May 2015 15:53:33 +0000 (11:53 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 12 Jun 2015 17:10:37 +0000 (13:10 -0400)
Reduce resource consumption per-transport to make way for increasing
the credit limit and maximum r/wsize. Pre-allocate fewer MRs.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Devesh Sharma <devesh.sharma@avagotech.com>
Tested-By: Devesh Sharma <devesh.sharma@avagotech.com>
Reviewed-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtrdma/fmr_ops.c
net/sunrpc/xprtrdma/frwr_ops.c

index 4a53ad5ab4b36722e5597888985987b60edf6cc9..f1e8dafbd5079b3406a769ba4854ecba229edca6 100644 (file)
@@ -69,8 +69,10 @@ fmr_op_init(struct rpcrdma_xprt *r_xprt)
        INIT_LIST_HEAD(&buf->rb_mws);
        INIT_LIST_HEAD(&buf->rb_all);
 
-       i = (buf->rb_max_requests + 1) * RPCRDMA_MAX_SEGS;
-       dprintk("RPC:       %s: initializing %d FMRs\n", __func__, i);
+       i = max_t(int, RPCRDMA_MAX_DATA_SEGS / RPCRDMA_MAX_FMR_SGES, 1);
+       i += 2;                         /* head + tail */
+       i *= buf->rb_max_requests;      /* one set for each RPC slot */
+       dprintk("RPC:       %s: initalizing %d FMRs\n", __func__, i);
 
        rc = -ENOMEM;
        while (i--) {
index 18b7305d249fbc676a782ced87b6258e40f3bd70..661fbc1784abc21e27bd5a49f7346eb26eac1178 100644 (file)
@@ -270,8 +270,10 @@ frwr_op_init(struct rpcrdma_xprt *r_xprt)
        INIT_LIST_HEAD(&buf->rb_mws);
        INIT_LIST_HEAD(&buf->rb_all);
 
-       i = (buf->rb_max_requests + 1) * RPCRDMA_MAX_SEGS;
-       dprintk("RPC:       %s: initializing %d FRMRs\n", __func__, i);
+       i = max_t(int, RPCRDMA_MAX_DATA_SEGS / depth, 1);
+       i += 2;                         /* head + tail */
+       i *= buf->rb_max_requests;      /* one set for each RPC slot */
+       dprintk("RPC:       %s: initalizing %d FRMRs\n", __func__, i);
 
        while (i--) {
                struct rpcrdma_mw *r;