unsigned int posted = 0;
        int ret = 0;
        bool can_wait = !!(gfp & __GFP_DIRECT_RECLAIM);
+       bool must_wake = false;
        u32 pos;
 
        /* the goal here is to just make sure that someone, somewhere
                recv = &ic->i_recvs[pos];
                ret = rds_ib_recv_refill_one(conn, recv, gfp);
                if (ret) {
+                       must_wake = true;
                        break;
                }
 
                }
 
                posted++;
+
+               if ((posted > 128 && need_resched()) || posted > 8192) {
+                       must_wake = true;
+                       break;
+               }
        }
 
        /* We're doing flow control - update the window. */
         * 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();
 }
 
 /*