Skip to contentSkip to conversation

knfsd: repcache: add statistics

PATCH In review Greg Banks 1 participant 1 message Oct 11, 2006

Subsystems (2)
lore
Share & tools
lore

Greg Banks

author
#0 lore raw

PATCH 8/8 knfsd: repcache: add statistics

knfsd: Add more statistics to the duplicate request cache; we now track the memory usage of the data structure, the age of evicted entries, and probes along hash chains.

Also, reduce contention for the cachelines of the global nfsdstats structure by keeping repcache stats per-bucket and aggregating them on demand when userspace reads /proc.

---

 fs/nfsd/nfscache.c         |   72 ++++++++++++++++++++++++++++++++--
 fs/nfsd/stats.c            |   11 +++++
 include/linux/nfsd/cache.h |    1 
 include/linux/nfsd/stats.h |    7 +++
 4 files changed, 88 insertions(+), 3 deletions(-)
fs/nfsd/stats.c +11 -0
Index: linux-git-20061009/fs/nfsd/stats.c
===================================================================
@@ -34,6 +34,7 @@
 #include <linux/sunrpc/stats.h>
 #include <linux/nfsd/nfsd.h>
 #include <linux/nfsd/stats.h>
+#include <linux/nfsd/cache.h>
 
 struct nfsd_stats	nfsdstats;
 struct svc_stat		nfsd_svcstats = {
@@ -44,6 +45,8 @@ static int nfsd_proc_show(struct seq_fil
 {
 	int i;
 
+	nfsd_cache_update_stats();
+
 	seq_printf(seq, "rc %u %u %u\nfh %u %u %u %u %u\nio %u %u\n",
 		      nfsdstats.rchits,
 		      nfsdstats.rcmisses,
@@ -72,6 +75,14 @@ static int nfsd_proc_show(struct seq_fil
 	/* show my rpc info */
 	svc_seq_show(seq, &nfsd_svcstats);
 
+	/* extended repcache stats */
+	seq_printf(seq, "rc2 %u %u %u %u %u\n",
+			nfsdstats.rcprobes,
+			nfsdstats.rcexpands,
+			nfsdstats.rcentries,
+			nfsdstats.rcmem,
+			(1000 * nfsdstats.rcage) / HZ);
+
 #ifdef CONFIG_NFSD_V4
 	/* Show count for individual nfsv4 operations */
 	/* Writing operation numbers 0 1 2 also for maintaining uniformity */
include/linux/nfsd/stats.h +7 -0
Index: linux-git-20061009/include/linux/nfsd/stats.h
===================================================================
@@ -29,6 +29,13 @@ struct nfsd_stats {
 	unsigned int	ra_size;	/* size of ra cache */
 	unsigned int	ra_depth[11];	/* number of times ra entry was found that deep
 					 * in the cache (10percentiles). [10] = not found */
+	/* extended repcache stats */
+	unsigned int	rcprobes;	/* counter: walks down hash chains */
+	unsigned int	rcexpands;	/* counter: when the cache is expanded */
+	unsigned int	rcentries;	/* instant: # entries */
+	unsigned int	rcmem;		/* instant: bytes of memory used */
+	unsigned int	rcage;		/* instant: age in milliseconds of last
+					 * entry reused from the LRU list */
 #ifdef CONFIG_NFSD_V4
 	unsigned int	nfs4_opcount[LAST_NFS4_OP + 1];	/* count of individual nfsv4 operations */
 #endif
fs/nfsd/nfscache.c +69 -3

156 lines not on this page · raw message

include/linux/nfsd/cache.h +1 -0
Index: linux-git-20061009/include/linux/nfsd/cache.h
===================================================================
@@ -75,6 +75,7 @@ void	nfsd_cache_init(void);
 void	nfsd_cache_shutdown(void);
 int	nfsd_cache_lookup(struct svc_rqst *, int);
 void	nfsd_cache_update(struct svc_rqst *, int, u32 *);
+void	nfsd_cache_update_stats(void);
 
 #endif /* __KERNEL__ */
 #endif /* NFSCACHE_H */

Greg.

Signature · 13 lines
Greg Banks, R&D Software Engineer, SGI Australian Software Group.
I don't speak for SGI.



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist  -  [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs