Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <venkat.x.venkatsubra@oracle.com>
that triggers "must_wake" if "rds_ib_recv_refill_one" fails.

Signed-off-by: Gerd Rausch <gerd.rausch@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Chris Mason and committed by
David S. Miller
65dedd7f 907389b7

+11 -1
+11 -1
net/rds/ib_recv.c
··· 385 385 unsigned int posted = 0; 386 386 int ret = 0; 387 387 bool can_wait = !!(gfp & __GFP_DIRECT_RECLAIM); 388 + bool must_wake = false; 388 389 u32 pos; 389 390 390 391 /* the goal here is to just make sure that someone, somewhere ··· 406 405 recv = &ic->i_recvs[pos]; 407 406 ret = rds_ib_recv_refill_one(conn, recv, gfp); 408 407 if (ret) { 408 + must_wake = true; 409 409 break; 410 410 } 411 411 ··· 425 423 } 426 424 427 425 posted++; 426 + 427 + if ((posted > 128 && need_resched()) || posted > 8192) { 428 + must_wake = true; 429 + break; 430 + } 428 431 } 429 432 430 433 /* We're doing flow control - update the window. */ ··· 452 445 * if we should requeue. 453 446 */ 454 447 if (rds_conn_up(conn) && 455 - ((can_wait && rds_ib_ring_low(&ic->i_recv_ring)) || 448 + (must_wake || 449 + (can_wait && rds_ib_ring_low(&ic->i_recv_ring)) || 456 450 rds_ib_ring_empty(&ic->i_recv_ring))) { 457 451 queue_delayed_work(rds_wq, &conn->c_recv_w, 1); 458 452 } 453 + if (can_wait) 454 + cond_resched(); 459 455 } 460 456 461 457 /*