From: Chris Mason Date: Fri, 3 Feb 2012 16:07:54 +0000 (-0500) Subject: RDS: limit the number of times we loop in rds_send_xmit X-Git-Tag: v4.1.12-92~319^2^2~2^2~47 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1b706bf9a13c3aa7a03fe928dd4a502e984fe402;p=users%2Fjedix%2Flinux-maple.git RDS: limit the number of times we loop in rds_send_xmit This will kick the RDS worker thread if we have been looping too long. Signed-off-by: Chris Mason Signed-off-by: Bang Nguyen --- diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c index 8502b8c3fc670..d0ab1222634ff 100644 --- a/net/rds/ib_recv.c +++ b/net/rds/ib_recv.c @@ -381,6 +381,7 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp) unsigned int posted = 0; int ret = 0; int can_wait = gfp & __GFP_WAIT; + int must_wake = 0; u32 pos; /* @@ -419,6 +420,11 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp) } posted++; + + if ((posted > 128 && need_resched()) || posted > 8192) { + must_wake = 1; + break; + } } /* We're doing flow control - update the window. */ @@ -441,10 +447,13 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp) * if we should requeue. */ if (rds_conn_up(conn) && - ((can_wait && rds_ib_ring_low(&ic->i_recv_ring)) || + (must_wake || + (can_wait && rds_ib_ring_low(&ic->i_recv_ring)) || rds_ib_ring_empty(&ic->i_recv_ring))) { queue_delayed_work(rds_wq, &conn->c_recv_w, 1); } + if (can_wait) + cond_resched(); } /*