rds: check for excessive looping in rds_send_xmit
authorAndy Grover <andy.grover@oracle.com>
Thu, 13 Jan 2011 19:40:31 +0000 (11:40 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 15 Aug 2019 19:04:24 +0000 (12:04 -0700)
Original commit from 2011 updated to include a change by
Yuval Shaia <yuval.shaia@oracle.com>
that adds a new statistic counter "send_stuck_rm"
to capture the messages looping exessively
in the send path.

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>
net/rds/rds.h
net/rds/send.c
net/rds/stats.c

index f0066d16849936955bee8699eacae1d4eb04ee2c..ad605fd61655e814706cd1807376c53ead2e2c04 100644 (file)
@@ -717,7 +717,7 @@ struct rds_statistics {
        uint64_t        s_cong_send_blocked;
        uint64_t        s_recv_bytes_added_to_socket;
        uint64_t        s_recv_bytes_removed_from_socket;
-
+       uint64_t        s_send_stuck_rm;
 };
 
 /* af_rds.c */
index 031b1e97a46639c86da300fa777009078488f5e9..9ce552abf9e9c6c8176a5052c0c1c4211058b088 100644 (file)
@@ -145,6 +145,7 @@ int rds_send_xmit(struct rds_conn_path *cp)
        LIST_HEAD(to_be_dropped);
        int batch_count;
        unsigned long send_gen = 0;
+       int same_rm = 0;
 
 restart:
        batch_count = 0;
@@ -200,6 +201,17 @@ restart:
 
                rm = cp->cp_xmit_rm;
 
+               if (!rm) {
+                       same_rm = 0;
+               } else {
+                       same_rm++;
+                       if (same_rm >= 4096) {
+                               rds_stats_inc(s_send_stuck_rm);
+                               ret = -EAGAIN;
+                               break;
+                       }
+               }
+
                /*
                 * If between sending messages, we can send a pending congestion
                 * map update.
index 6bbab4d74c4fecfe3a3b94851c87406d6d887b17..9e87da43c0045211e8be52ee37d6bfe52f589e9a 100644 (file)
@@ -78,6 +78,7 @@ static const char *const rds_stat_names[] = {
        "cong_send_blocked",
        "recv_bytes_added_to_sock",
        "recv_bytes_freed_fromsock",
+       "send_stuck_rm",
 };
 
 void rds_stats_info_copy(struct rds_info_iterator *iter,