aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2014-05-28 10:33:51 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2014-06-04 08:56:45 -0400
commit8301a2c047cc25dabd645e5590c1db0ead4c5af4 (patch)
treeeb9901cc1585570fe8306d05d6d3b381662ef1ce /net/sunrpc
parent1c00dd0776543608e13c74a527660cb8cd28a74f (diff)
xprtrdma: Limit work done by completion handler
Sagi Grimberg <sagig@dev.mellanox.co.il> points out that a steady stream of CQ events could starve other work because of the boundless loop pooling in rpcrdma_{send,recv}_poll(). Instead of a (potentially infinite) while loop, return after collecting a budgeted number of completions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Acked-by: Sagi Grimberg <sagig@dev.mellanox.co.il> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/xprtrdma/verbs.c10
-rw-r--r--net/sunrpc/xprtrdma/xprt_rdma.h1
2 files changed, 7 insertions, 4 deletions
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index b8caee91661c..1d083664bfca 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -165,8 +165,9 @@ static int
165rpcrdma_sendcq_poll(struct ib_cq *cq, struct rpcrdma_ep *ep) 165rpcrdma_sendcq_poll(struct ib_cq *cq, struct rpcrdma_ep *ep)
166{ 166{
167 struct ib_wc *wcs; 167 struct ib_wc *wcs;
168 int count, rc; 168 int budget, count, rc;
169 169
170 budget = RPCRDMA_WC_BUDGET / RPCRDMA_POLLSIZE;
170 do { 171 do {
171 wcs = ep->rep_send_wcs; 172 wcs = ep->rep_send_wcs;
172 173
@@ -177,7 +178,7 @@ rpcrdma_sendcq_poll(struct ib_cq *cq, struct rpcrdma_ep *ep)
177 count = rc; 178 count = rc;
178 while (count-- > 0) 179 while (count-- > 0)
179 rpcrdma_sendcq_process_wc(wcs++); 180 rpcrdma_sendcq_process_wc(wcs++);
180 } while (rc == RPCRDMA_POLLSIZE); 181 } while (rc == RPCRDMA_POLLSIZE && --budget);
181 return 0; 182 return 0;
182} 183}
183 184
@@ -254,8 +255,9 @@ static int
254rpcrdma_recvcq_poll(struct ib_cq *cq, struct rpcrdma_ep *ep) 255rpcrdma_recvcq_poll(struct ib_cq *cq, struct rpcrdma_ep *ep)
255{ 256{
256 struct ib_wc *wcs; 257 struct ib_wc *wcs;
257 int count, rc; 258 int budget, count, rc;
258 259
260 budget = RPCRDMA_WC_BUDGET / RPCRDMA_POLLSIZE;
259 do { 261 do {
260 wcs = ep->rep_recv_wcs; 262 wcs = ep->rep_recv_wcs;
261 263
@@ -266,7 +268,7 @@ rpcrdma_recvcq_poll(struct ib_cq *cq, struct rpcrdma_ep *ep)
266 count = rc; 268 count = rc;
267 while (count-- > 0) 269 while (count-- > 0)
268 rpcrdma_recvcq_process_wc(wcs++); 270 rpcrdma_recvcq_process_wc(wcs++);
269 } while (rc == RPCRDMA_POLLSIZE); 271 } while (rc == RPCRDMA_POLLSIZE && --budget);
270 return 0; 272 return 0;
271} 273}
272 274
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h
index cb4c882b97fe..0c3b88ea5edb 100644
--- a/net/sunrpc/xprtrdma/xprt_rdma.h
+++ b/net/sunrpc/xprtrdma/xprt_rdma.h
@@ -74,6 +74,7 @@ struct rpcrdma_ia {
74 * RDMA Endpoint -- one per transport instance 74 * RDMA Endpoint -- one per transport instance
75 */ 75 */
76 76
77#define RPCRDMA_WC_BUDGET (128)
77#define RPCRDMA_POLLSIZE (16) 78#define RPCRDMA_POLLSIZE (16)
78 79
79struct rpcrdma_ep { 80struct rpcrdma_ep {