RDS: add stat for socket recv memory usage
authorVenkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
Sun, 10 Jul 2016 00:36:20 +0000 (17:36 -0700)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Mon, 2 Jan 2017 22:02:56 +0000 (14:02 -0800)
Tracks the receive side memory added to scokets and removed from sockets.

Signed-off-by: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
net/rds/rds.h
net/rds/recv.c

index 0bb8213c7d0bffb10a28860b36be6508ce1f5152..8ccd5a93e56c015af5ec6a5d96483bd876450892 100644 (file)
@@ -631,6 +631,9 @@ struct rds_statistics {
        uint64_t        s_cong_update_received;
        uint64_t        s_cong_send_error;
        uint64_t        s_cong_send_blocked;
+       uint64_t        s_recv_bytes_added_to_socket;
+       uint64_t        s_recv_bytes_removed_from_socket;
+
 };
 
 /* af_rds.c */
index 9d0666e5fe35db4215ef9c7aae9903d73f1fc5b2..ba19eeeae85a482c47040c3f43dd204e47e628f6 100644 (file)
@@ -94,6 +94,10 @@ static void rds_recv_rcvbuf_delta(struct rds_sock *rs, struct sock *sk,
                return;
 
        rs->rs_rcv_bytes += delta;
+       if (delta > 0)
+               rds_stats_add(s_recv_bytes_added_to_socket, delta);
+       else
+               rds_stats_add(s_recv_bytes_removed_from_socket, -delta);
        now_congested = rs->rs_rcv_bytes > rds_sk_rcvbuf(rs);
 
        rdsdebug("rs %p (%pI4:%u) recv bytes %d buf %d "