Skip to content

Commit 08cf2ef

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Use smaller buffers for RPC-over-RDMA headers
Commit 9493174 ("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>
1 parent 9c40c49 commit 08cf2ef

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

net/sunrpc/xprtrdma/backchannel.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,12 @@ static int rpcrdma_bc_setup_rqst(struct rpcrdma_xprt *r_xprt,
4545
return PTR_ERR(req);
4646
req->rl_backchannel = true;
4747

48-
size = r_xprt->rx_data.inline_wsize;
49-
rb = rpcrdma_alloc_regbuf(ia, size, GFP_KERNEL);
48+
rb = rpcrdma_alloc_regbuf(ia, RPCRDMA_HDRBUF_SIZE, GFP_KERNEL);
5049
if (IS_ERR(rb))
5150
goto out_fail;
5251
req->rl_rdmabuf = rb;
5352

54-
size += r_xprt->rx_data.inline_rsize;
53+
size = r_xprt->rx_data.inline_rsize;
5554
rb = rpcrdma_alloc_regbuf(ia, size, GFP_KERNEL);
5655
if (IS_ERR(rb))
5756
goto out_fail;

net/sunrpc/xprtrdma/transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ static bool
484484
rpcrdma_get_rdmabuf(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req,
485485
gfp_t flags)
486486
{
487-
size_t size = r_xprt->rx_data.inline_wsize;
487+
size_t size = RPCRDMA_HDRBUF_SIZE;
488488
struct rpcrdma_regbuf *rb;
489489

490490
if (req->rl_rdmabuf)

net/sunrpc/xprtrdma/xprt_rdma.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ rdmab_to_msg(struct rpcrdma_regbuf *rb)
160160
* The smallest inline threshold is 1024 bytes, ensuring that
161161
* at least 750 bytes are available for RPC messages.
162162
*/
163-
#define RPCRDMA_MAX_HDR_SEGS (8)
163+
enum {
164+
RPCRDMA_MAX_HDR_SEGS = 8,
165+
RPCRDMA_HDRBUF_SIZE = 256,
166+
};
164167

165168
/*
166169
* struct rpcrdma_rep -- this structure encapsulates state required to recv

0 commit comments

Comments
 (0)