linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Santosh Shilimkar <santosh.shilimkar@oracle.com>
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: linux-kernel@vger.kernel.org, santosh.shilimkar@oracle.com
Subject: [net-next][PATCH v3 11/17] RDS: IB: add few useful cache stasts
Date: Mon,  2 Jan 2017 14:45:46 -0800	[thread overview]
Message-ID: <1483397152-8307-12-git-send-email-santosh.shilimkar@oracle.com> (raw)
In-Reply-To: <1483397152-8307-1-git-send-email-santosh.shilimkar@oracle.com>

Tracks the ib receive cache total, incoming and frag allocations.

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
---
 net/rds/ib.h       | 7 +++++++
 net/rds/ib_recv.c  | 6 ++++++
 net/rds/ib_stats.c | 2 ++
 3 files changed, 15 insertions(+)

diff --git a/net/rds/ib.h b/net/rds/ib.h
index 5f02b4d..c62e551 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -151,6 +151,7 @@ struct rds_ib_connection {
 	u64			i_ack_recv;	/* last ACK received */
 	struct rds_ib_refill_cache i_cache_incs;
 	struct rds_ib_refill_cache i_cache_frags;
+	atomic_t		i_cache_allocs;
 
 	/* sending acks */
 	unsigned long		i_ack_flags;
@@ -254,6 +255,8 @@ struct rds_ib_statistics {
 	uint64_t	s_ib_rx_refill_from_cq;
 	uint64_t	s_ib_rx_refill_from_thread;
 	uint64_t	s_ib_rx_alloc_limit;
+	uint64_t	s_ib_rx_total_frags;
+	uint64_t	s_ib_rx_total_incs;
 	uint64_t	s_ib_rx_credit_updates;
 	uint64_t	s_ib_ack_sent;
 	uint64_t	s_ib_ack_send_failure;
@@ -276,6 +279,8 @@ struct rds_ib_statistics {
 	uint64_t	s_ib_rdma_mr_1m_reused;
 	uint64_t	s_ib_atomic_cswp;
 	uint64_t	s_ib_atomic_fadd;
+	uint64_t	s_ib_recv_added_to_cache;
+	uint64_t	s_ib_recv_removed_from_cache;
 };
 
 extern struct workqueue_struct *rds_ib_wq;
@@ -406,6 +411,8 @@ int rds_ib_send_grab_credits(struct rds_ib_connection *ic, u32 wanted,
 /* ib_stats.c */
 DECLARE_PER_CPU(struct rds_ib_statistics, rds_ib_stats);
 #define rds_ib_stats_inc(member) rds_stats_inc_which(rds_ib_stats, member)
+#define rds_ib_stats_add(member, count) \
+		rds_stats_add_which(rds_ib_stats, member, count)
 unsigned int rds_ib_stats_info_copy(struct rds_info_iterator *iter,
 				    unsigned int avail);
 
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
index 6803b75..4b0f126 100644
--- a/net/rds/ib_recv.c
+++ b/net/rds/ib_recv.c
@@ -194,6 +194,8 @@ static void rds_ib_frag_free(struct rds_ib_connection *ic,
 	rdsdebug("frag %p page %p\n", frag, sg_page(&frag->f_sg));
 
 	rds_ib_recv_cache_put(&frag->f_cache_entry, &ic->i_cache_frags);
+	atomic_add(RDS_FRAG_SIZE / SZ_1K, &ic->i_cache_allocs);
+	rds_ib_stats_add(s_ib_recv_added_to_cache, RDS_FRAG_SIZE);
 }
 
 /* Recycle inc after freeing attached frags */
@@ -261,6 +263,7 @@ static struct rds_ib_incoming *rds_ib_refill_one_inc(struct rds_ib_connection *i
 			atomic_dec(&rds_ib_allocation);
 			return NULL;
 		}
+		rds_ib_stats_inc(s_ib_rx_total_incs);
 	}
 	INIT_LIST_HEAD(&ibinc->ii_frags);
 	rds_inc_init(&ibinc->ii_inc, ic->conn, ic->conn->c_faddr);
@@ -278,6 +281,8 @@ static struct rds_page_frag *rds_ib_refill_one_frag(struct rds_ib_connection *ic
 	cache_item = rds_ib_recv_cache_get(&ic->i_cache_frags);
 	if (cache_item) {
 		frag = container_of(cache_item, struct rds_page_frag, f_cache_entry);
+		atomic_sub(RDS_FRAG_SIZE / SZ_1K, &ic->i_cache_allocs);
+		rds_ib_stats_add(s_ib_recv_added_to_cache, RDS_FRAG_SIZE);
 	} else {
 		frag = kmem_cache_alloc(rds_ib_frag_slab, slab_mask);
 		if (!frag)
@@ -290,6 +295,7 @@ static struct rds_page_frag *rds_ib_refill_one_frag(struct rds_ib_connection *ic
 			kmem_cache_free(rds_ib_frag_slab, frag);
 			return NULL;
 		}
+		rds_ib_stats_inc(s_ib_rx_total_frags);
 	}
 
 	INIT_LIST_HEAD(&frag->f_item);
diff --git a/net/rds/ib_stats.c b/net/rds/ib_stats.c
index 7e78dca..9252ad1 100644
--- a/net/rds/ib_stats.c
+++ b/net/rds/ib_stats.c
@@ -55,6 +55,8 @@
 	"ib_rx_refill_from_cq",
 	"ib_rx_refill_from_thread",
 	"ib_rx_alloc_limit",
+	"ib_rx_total_frags",
+	"ib_rx_total_incs",
 	"ib_rx_credit_updates",
 	"ib_ack_sent",
 	"ib_ack_send_failure",
-- 
1.9.1

  parent reply	other threads:[~2017-01-02 22:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-02 22:45 [net-next][PATCH v3 00/17] net: RDS updates Santosh Shilimkar
2017-01-02 22:45 ` [net-next][PATCH v3 01/17] RDS: log the address on bind failure Santosh Shilimkar
2017-01-02 22:45 ` [net-next][PATCH v3 02/17] RDS: mark few internal functions static to make sparse build happy Santosh Shilimkar
2017-01-02 22:45 ` [net-next][PATCH v3 03/17] RDS: IB: include faddr in connection log Santosh Shilimkar
2017-01-02 22:45 ` [net-next][PATCH v3 04/17] RDS: IB: make the transport retry count smallest Santosh Shilimkar
2017-01-02 22:45 ` [net-next][PATCH v3 05/17] RDS: RDMA: fix the ib_map_mr_sg_zbva() argument Santosh Shilimkar
2017-01-02 22:45 ` [net-next][PATCH v3 06/17] RDS: RDMA: start rdma listening after init Santosh Shilimkar
2017-01-02 22:45 ` [net-next][PATCH v3 07/17] RDS: RDMA: return appropriate error on rdma map failures Santosh Shilimkar
2017-01-02 22:45 ` [net-next][PATCH v3 08/17] RDS: IB: split the mr registration and invalidation path Santosh Shilimkar
2017-01-02 22:45 ` [net-next][PATCH v3 09/17] RDS: RDMA: silence the use_once mr log flood Santosh Shilimkar
2017-01-02 22:45 ` [net-next][PATCH v3 10/17] RDS: IB: track and log active side endpoint in connection Santosh Shilimkar
2017-01-02 22:45 ` Santosh Shilimkar [this message]
2017-01-02 22:45 ` [net-next][PATCH v3 12/17] RDS: IB: Add vector spreading for cqs Santosh Shilimkar
2017-01-02 22:45 ` [net-next][PATCH v3 13/17] RDS: RDMA: Fix the composite message user notification Santosh Shilimkar
2017-01-02 22:45 ` [net-next][PATCH v3 14/17] RDS: IB: fix panic due to handlers running post teardown Santosh Shilimkar
2017-01-02 22:45 ` [net-next][PATCH v3 15/17] RDS: add stat for socket recv memory usage Santosh Shilimkar
2017-01-02 22:45 ` [net-next][PATCH v3 16/17] RDS: make message size limit compliant with spec Santosh Shilimkar
2017-01-02 22:45 ` [net-next][PATCH v3 17/17] RDS: add receive message trace used by application Santosh Shilimkar
2017-01-03 14:46 ` [net-next][PATCH v3 00/17] net: RDS updates David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1483397152-8307-12-git-send-email-santosh.shilimkar@oracle.com \
    --to=santosh.shilimkar@oracle.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).