knfsd: add svc_set_num_threads
Subsystems (3)
PATCH 1/1 knfsd: add svc_set_num_threads
knfsd: Currently knfsd keeps its own list of all nfsd threads in nfssvc.c; add a new way of managing the list of all threads in a svc_serv. Add svc_create_pooled() to allow creation of a svc_serv whose threads are managed by the sunrpc code. Add svc_set_num_threads() to manage the number of threads in a service, either per-pool or globally across the service.
Signed-off-by Greg Banks <[email protected]>
---
include/linux/sunrpc/svc.h | 19 +++- net/sunrpc/sunrpc_syms.c | 2 net/sunrpc/svc.c | 137 +++++++++++++++++++++++++++++++++- 3 files changed, 150 insertions(+), 8 deletions(-)
include/linux/sunrpc/svc.h +14 -5
@@ -17,6 +17,10 @@#include <linux/wait.h> #include <linux/mm.h> +/* +* This is the RPC server thread function prototype +*/ +typedef void (*svc_thread_fn )(struct svc_rqst *);/* *
@@ -34,6 +38,7 @@ struct svc_pool {struct list_head sp_threads;/* idle server threads */ struct list_head sp_sockets;/* pending sockets */ unsigned int sp_nrthreads;/* # of threads in pool */ +struct list_head sp_all_threads;/* all server threads */ }____cacheline_aligned_in_smp ;/*
@@ -62,6 +67,10 @@ struct svc_serv {char * sv_name;/* service name */ unsigned int sv_nrpools;/* number of thread pools */ struct svc_pool * sv_pools;/* array of thread pools */ +struct module * sv_module;/* optional module to count when +* adding threads */ +svc_thread_fn sv_function;/* main function for threads */ +int sv_kill_signal;/* signal to kill threads */ };/*
@@ -141,6 +150,7 @@ static inline void svc_putu32(struct kve*/ struct svc_rqst {struct list_head rq_list;/* idle list */ +struct list_head rq_all;/* all threads list */ struct svc_sock * rq_sock;/* socket */ struct sockaddr_in rq_addr;/* peer address */ int rq_addrlen;
@@ -195,6 +205,7 @@ struct svc_rqst {* to prevent encrypting page * cache pages */ wait_queue_head_t rq_wait;/* synchronization */ +struct task_struct *rq_task;/* service thread */ };/*
@@ -336,16 +347,14 @@ struct svc_procedure { };/* -* This is the RPC server thread function prototype -*/ -typedef void (*svc_thread_fn )(struct svc_rqst *); - -/* * Function prototypes. */ struct svc_serv *svc_create (struct svc_program *,unsigned int );int svc_create_thread (svc_thread_fn ,struct svc_serv *);void svc_exit_thread (struct svc_rqst *); +struct svc_serv *svc_create_pooled (struct svc_program *,unsigned int , +svc_thread_fn ,int sig,struct module *); +int svc_set_num_threads (struct svc_serv *,struct svc_pool *,int );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/sunrpc_syms.c +2 -0
@@ -73,6 +73,8 @@ EXPORT_SYMBOL(put_rpccred);/* RPC server stuff */ EXPORT_SYMBOL (svc_create);EXPORT_SYMBOL (svc_create_thread); +EXPORT_SYMBOL (svc_create_pooled); +EXPORT_SYMBOL (svc_set_num_threads);EXPORT_SYMBOL (svc_exit_thread);EXPORT_SYMBOL (svc_destroy);EXPORT_SYMBOL (svc_drop);
net/sunrpc/svc.c +134 -3
185 lines not on this page · raw message
Signature · 13 lines
Greg Banks, R&D Software Engineer, SGI Australian Software Group. I don't speak for SGI. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ NFS maillist - [email protected] https://lists.sourceforge.net/lists/listinfo/nfs