Skip to contentSkip to conversation

SUNRPC: More fixes for backlog congestion

PATCH Superseded [email protected] 1 participant 1 message May 26, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 SUNRPC: More fixes for backlog congestion

From: Trond Myklebust <[email protected]>

Ensure that we fix the XPRT_CONGESTED starvation issue for RDMA as well as socket based transports.
Ensure we always initialise the request after waking up from the backlog list.

Fixes e877a88d1f06 ("SUNRPC in case of backlog, hand free slots directly to waiting task")
---
 include/linux/sunrpc/xprt.h     |  2 ++
 net/sunrpc/xprt.c               | 58 ++++++++++++++++-----------------
 net/sunrpc/xprtrdma/transport.c |  6 ++--
 3 files changed, 32 insertions(+), 34 deletions(-)
include/linux/sunrpc/xprt.h +2 -0
index d81fe8b364d0..61b622e334ee 100644
@@ -368,6 +368,8 @@ struct rpc_xprt *	xprt_alloc(struct net *net, size_t size,
 				unsigned int num_prealloc,
 				unsigned int max_req);
 void			xprt_free(struct rpc_xprt *);
+void			xprt_add_backlog(struct rpc_xprt *xprt, struct rpc_task *task);
+bool			xprt_wake_up_backlog(struct rpc_xprt *xprt, struct rpc_rqst *req);
 
 static inline int
 xprt_enable_swap(struct rpc_xprt *xprt)
net/sunrpc/xprt.c +28 -30

110 lines not on this page · raw message

net/sunrpc/xprtrdma/transport.c +2 -4
index 09953597d055..4a8f92ef99ae 100644
@@ -520,9 +520,8 @@ xprt_rdma_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task)
 	return;
 
 out_sleep:
-	set_bit(XPRT_CONGESTED, &xprt->state);
-	rpc_sleep_on(&xprt->backlog, task, NULL);
 	task->tk_status = -EAGAIN;
+	xprt_add_backlog(xprt, task);
 }
 
 /**
@@ -539,8 +538,7 @@ xprt_rdma_free_slot(struct rpc_xprt *xprt, struct rpc_rqst *rqst)
 
 	memset(rqst, 0, sizeof(*rqst));
 	rpcrdma_buffer_put(&r_xprt->rx_buf, rpcr_to_rdmar(rqst));
-	if (unlikely(!rpc_wake_up_next(&xprt->backlog)))
-		clear_bit(XPRT_CONGESTED, &xprt->state);
+	xprt_wake_up_backlog(xprt, rqst);
 }
 
 static bool rpcrdma_check_regbuf(struct rpcrdma_xprt *r_xprt,
Signature · 1 line
2.31.1