Skip to contentSkip to conversation

knfsd: add RPC pool thread stats

PATCH New Greg Banks 1 participant 1 message Aug 8, 2006

Subsystems (3)
lore
Share & tools
lore

Greg Banks

author
#0 lore raw

PATCH 1/1 knfsd: add RPC pool thread stats

knfsd: Add /proc/fs/nfsd/pool_stats to export to userspace various statistics about the operation of rpc server thread pools.

---

 fs/nfsd/nfsctl.c           |   12 ++++
 fs/nfsd/nfssvc.c           |    5 +
 include/linux/sunrpc/svc.h |   11 +++
 net/sunrpc/sunrpc_syms.c   |    1 
 net/sunrpc/svcsock.c       |   96 +++++++++++++++++++++++++++++++++-
 5 files changed, 124 insertions(+), 1 deletion(-)
fs/nfsd/nfsctl.c +12 -0
Index: linux-2.6.18-rc2/fs/nfsd/nfsctl.c
===================================================================
@@ -55,6 +55,7 @@ enum {
 	NFSD_Fh,
 	NFSD_Threads,
 	NFSD_Pool_Threads,
+	NFSD_Pool_Stats,
 	NFSD_Versions,
 	NFSD_Ports,
 	/*
@@ -160,6 +161,16 @@ static const struct file_operations expo
 	.release	= seq_release,
 };
 
+extern int nfsd_pool_stats_open(struct inode *inode, struct file *file);
+
+static struct file_operations pool_stats_operations = {
+	.owner		= THIS_MODULE,
+	.open		= nfsd_pool_stats_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= seq_release,
+};
+
 /*----------------------------------------------------------------------------*/
 /*
  * payload - write methods
@@ -611,6 +622,7 @@ static int nfsd_fill_super(struct super_
 		[NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR},
 		[NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR},
 		[NFSD_Pool_Threads] = {"pool_threads", &transaction_ops, S_IWUSR|S_IRUSR},
+		[NFSD_Pool_Stats] = {"pool_stats", &pool_stats_operations, S_IRUGO},
 		[NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR},
 		[NFSD_Ports] = {"portlist", &transaction_ops, S_IWUSR|S_IRUGO},
 #ifdef CONFIG_NFSD_V4
fs/nfsd/nfssvc.c +5 -0
Index: linux-2.6.18-rc2/fs/nfsd/nfssvc.c
===================================================================
@@ -543,3 +543,8 @@ nfsd_dispatch(struct svc_rqst *rqstp, u3
 	nfsd_cache_update(rqstp, proc->pc_cachetype, statp + 1);
 	return 1;
 }
+
+int nfsd_pool_stats_open(struct inode *inode, struct file *file)
+{
+	return svc_pool_stats_open(nfsd_serv, file);
+}
include/linux/sunrpc/svc.h +11 -0
Index: linux-2.6.18-rc2/include/linux/sunrpc/svc.h
===================================================================
@@ -23,6 +23,15 @@
  */
 typedef void		(*svc_thread_fn)(struct svc_rqst *);
 
+/* statistics for svc_pool structures */
+struct svc_pool_stats {
+	unsigned long	packets;
+	unsigned long	sockets_queued;
+	unsigned long	threads_woken;
+	unsigned long	overloads_avoided;
+	unsigned long	threads_timedout;
+};
+
 /*
  *
  * RPC service thread pool.
@@ -41,6 +50,7 @@ struct svc_pool {
 	unsigned int		sp_nrthreads;	/* # of threads in pool */
 	struct list_head	sp_all_threads;	/* all server threads */
 	int			sp_nwaking;	/* number of threads woken but not yet active */
+	struct svc_pool_stats	sp_stats;	/* statistics on pool operation */
 } ____cacheline_aligned_in_smp;
 
 /*
@@ -386,6 +396,7 @@ struct svc_serv *  svc_create_pooled(str
 			void (*shutdown)(struct svc_serv*),
 			svc_thread_fn, int sig, struct module *);
 int		   svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
+int		   svc_pool_stats_open(struct svc_serv *serv, struct file *file);
 void		   svc_destroy(struct svc_serv *);
 int		   svc_process(struct svc_serv *, struct svc_rqst *);
 int		   svc_register(struct svc_serv *, int, unsigned short);
net/sunrpc/svcsock.c +95 -1

145 lines not on this page · raw message

net/sunrpc/sunrpc_syms.c +1 -0
Index: linux-2.6.18-rc2/net/sunrpc/sunrpc_syms.c
===================================================================
@@ -76,6 +76,7 @@ EXPORT_SYMBOL(svc_create_thread);
 EXPORT_SYMBOL(svc_create_pooled);
 EXPORT_SYMBOL(svc_set_num_threads);
 EXPORT_SYMBOL(svc_exit_thread);
+EXPORT_SYMBOL(svc_pool_stats_open);
 EXPORT_SYMBOL(svc_destroy);
 EXPORT_SYMBOL(svc_drop);
 EXPORT_SYMBOL(svc_process);

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