Skip to content
/ linux Public

Commit 63a45e2

Browse files
chuckleverSasha Levin
authored andcommitted
svcrdma: Increase the per-transport rw_ctx count
[ Upstream commit 2da0f61 ] rdma_rw_mr_factor() returns the smallest number of MRs needed to move a particular number of pages. svcrdma currently asks for the number of MRs needed to move RPCSVC_MAXPAGES (a little over one megabyte), as that is the number of pages in the largest r/wsize the server supports. This call assumes that the client's NIC can bundle a full one megabyte payload in a single rdma_segment. In fact, most NICs cannot handle a full megabyte with a single rkey / rdma_segment. Clients will typically split even a single Read chunk into many segments. The server needs one MR to read each rdma_segment in a Read chunk, and thus each one needs an rw_ctx. svcrdma has been vastly underestimating the number of rw_ctxs needed to handle 64 RPC requests with large Read chunks using small rdma_segments. Unfortunately there doesn't seem to be a good way to estimate this number without knowing the client NIC's capabilities. Even then, the client RPC/RDMA implementation is still free to split a chunk into smaller segments (for example, it might be using physical registration, which needs an rdma_segment per page). The best we can do for now is choose a number that will guarantee forward progress in the worst case (one page per segment). At some later point, we could add some mechanisms to make this much less of a problem: - Add a core API to add more rw_ctxs to an already-established QP - svcrdma could treat rw_ctx exhaustion as a temporary error and try again - Limit the number of Reads in flight Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Stable-dep-of: afcae7d ("RDMA/core: add rdma_rw_max_sge() helper for SQ sizing") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 46ccdde commit 63a45e2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

net/sunrpc/xprtrdma/svc_rdma_transport.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,13 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
415415
newxprt->sc_max_requests = rq_depth - 2;
416416
newxprt->sc_max_bc_requests = 2;
417417
}
418-
ctxts = rdma_rw_mr_factor(dev, newxprt->sc_port_num, RPCSVC_MAXPAGES);
419-
ctxts *= newxprt->sc_max_requests;
418+
419+
/* Arbitrarily estimate the number of rw_ctxs needed for
420+
* this transport. This is enough rw_ctxs to make forward
421+
* progress even if the client is using one rkey per page
422+
* in each Read chunk.
423+
*/
424+
ctxts = 3 * RPCSVC_MAXPAGES;
420425
newxprt->sc_sq_depth = rq_depth + ctxts;
421426
if (newxprt->sc_sq_depth > dev->attrs.max_qp_wr)
422427
newxprt->sc_sq_depth = dev->attrs.max_qp_wr;

0 commit comments

Comments
 (0)