]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
RDS: limit the number of times we loop in rds_send_xmit
authorChris Mason <chris.mason@oracle.com>
Fri, 3 Feb 2012 16:07:54 +0000 (11:07 -0500)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 23:41:30 +0000 (16:41 -0700)
This will kick the RDS worker thread if we have been looping
too long.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Bang Nguyen <bang.nguyen@oracle.com>
net/rds/ib_recv.c

index 8502b8c3fc670c3143838867703b244900a5e178..d0ab1222634ffc12d83dd0458f13ae0dd5f2d366 100644 (file)
@@ -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();
 }
 
 /*