xprtrdma: Use smaller buffers for RPC-over-RDMA headers
authorChuck Lever <chuck.lever@oracle.com>
Thu, 15 Sep 2016 14:56:02 +0000 (10:56 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Mon, 19 Sep 2016 17:08:37 +0000 (13:08 -0400)
Commit 949317464bc2 ("xprtrdma: Limit number of RDMA segments in
RPC-over-RDMA headers") capped the number of chunks that may appear
in RPC-over-RDMA headers. The maximum header size can be estimated
and fixed to avoid allocating buffer space that is never used.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtrdma/backchannel.c
net/sunrpc/xprtrdma/transport.c
net/sunrpc/xprtrdma/xprt_rdma.h

index c4904f881640189f6cdf1ae0096760a64d944637..60fc9915292f1a5a28371c94442444d902652a57 100644 (file)
@@ -45,13 +45,12 @@ static int rpcrdma_bc_setup_rqst(struct rpcrdma_xprt *r_xprt,
                return PTR_ERR(req);
        req->rl_backchannel = true;
 
-       size = r_xprt->rx_data.inline_wsize;
-       rb = rpcrdma_alloc_regbuf(ia, size, GFP_KERNEL);
+       rb = rpcrdma_alloc_regbuf(ia, RPCRDMA_HDRBUF_SIZE, GFP_KERNEL);
        if (IS_ERR(rb))
                goto out_fail;
        req->rl_rdmabuf = rb;
 
-       size += r_xprt->rx_data.inline_rsize;
+       size = r_xprt->rx_data.inline_rsize;
        rb = rpcrdma_alloc_regbuf(ia, size, GFP_KERNEL);
        if (IS_ERR(rb))
                goto out_fail;
index ecdc3ad7dbb6635274d8765176042f928562b65b..94dbfd3e89a79d2ac60dc28c57a73f9462db4103 100644 (file)
@@ -484,7 +484,7 @@ static bool
 rpcrdma_get_rdmabuf(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req,
                    gfp_t flags)
 {
-       size_t size = r_xprt->rx_data.inline_wsize;
+       size_t size = RPCRDMA_HDRBUF_SIZE;
        struct rpcrdma_regbuf *rb;
 
        if (req->rl_rdmabuf)
index 444f6370d46c11a2110a95e0c0f70c4524cd1a34..cc426b165c09092c9a20bb0a0096f8b415942526 100644 (file)
@@ -160,7 +160,10 @@ rdmab_to_msg(struct rpcrdma_regbuf *rb)
  * The smallest inline threshold is 1024 bytes, ensuring that
  * at least 750 bytes are available for RPC messages.
  */
-#define RPCRDMA_MAX_HDR_SEGS   (8)
+enum {
+       RPCRDMA_MAX_HDR_SEGS = 8,
+       RPCRDMA_HDRBUF_SIZE = 256,
+};
 
 /*
  * struct rpcrdma_rep -- this structure encapsulates state required to recv