Skip to content

Commit 65dedd7

Browse files
chrismason-xxdavem330
authored andcommitted
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. Original commit from 2012 updated to include a change by Venkat Venkatsubra <[email protected]> that triggers "must_wake" if "rds_ib_recv_refill_one" fails. Signed-off-by: Gerd Rausch <[email protected]> Acked-by: Santosh Shilimkar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 907389b commit 65dedd7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

net/rds/ib_recv.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp)
385385
unsigned int posted = 0;
386386
int ret = 0;
387387
bool can_wait = !!(gfp & __GFP_DIRECT_RECLAIM);
388+
bool must_wake = false;
388389
u32 pos;
389390

390391
/* the goal here is to just make sure that someone, somewhere
@@ -405,6 +406,7 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp)
405406
recv = &ic->i_recvs[pos];
406407
ret = rds_ib_recv_refill_one(conn, recv, gfp);
407408
if (ret) {
409+
must_wake = true;
408410
break;
409411
}
410412

@@ -423,6 +425,11 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp)
423425
}
424426

425427
posted++;
428+
429+
if ((posted > 128 && need_resched()) || posted > 8192) {
430+
must_wake = true;
431+
break;
432+
}
426433
}
427434

428435
/* We're doing flow control - update the window. */
@@ -445,10 +452,13 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp)
445452
* if we should requeue.
446453
*/
447454
if (rds_conn_up(conn) &&
448-
((can_wait && rds_ib_ring_low(&ic->i_recv_ring)) ||
455+
(must_wake ||
456+
(can_wait && rds_ib_ring_low(&ic->i_recv_ring)) ||
449457
rds_ib_ring_empty(&ic->i_recv_ring))) {
450458
queue_delayed_work(rds_wq, &conn->c_recv_w, 1);
451459
}
460+
if (can_wait)
461+
cond_resched();
452462
}
453463

454464
/*

0 commit comments

Comments
 (0)