aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sunrpc
diff options
context:
space:
mode:
authorGreg Banks <gnb@melbourne.sgi.com>2006-10-02 05:17:58 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 10:57:19 -0400
commit3262c816a3d7fb1eaabce633caa317887ed549ae (patch)
tree5b635d8b62b9724ab2b1e5563aad37e35b894406 /include/linux/sunrpc
parentc081a0c7cfe42adf8e8b9c2b8d0b2ec7f47603e8 (diff)
[PATCH] knfsd: split svc_serv into pools
Split out the list of idle threads and pending sockets from svc_serv into a new svc_pool structure, and allocate a fixed number (in this patch, 1) of pools per svc_serv. The new structure contains a lock which takes over several of the duties of svc_serv->sv_lock, which is now relegated to protecting only sv_tempsocks, sv_permsocks, and sv_tmpcnt in svc_serv. The point is to move the hottest fields out of svc_serv and into svc_pool, allowing a following patch to arrange for a svc_pool per NUMA node or per CPU. This is a major step towards making the NFS server NUMA-friendly. Signed-off-by: Greg Banks <gnb@melbourne.sgi.com> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/sunrpc')
-rw-r--r--include/linux/sunrpc/svc.h25
-rw-r--r--include/linux/sunrpc/svcsock.h1
2 files changed, 24 insertions, 2 deletions
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 5eabded11061..c27d806af310 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -17,6 +17,25 @@
17#include <linux/wait.h> 17#include <linux/wait.h>
18#include <linux/mm.h> 18#include <linux/mm.h>
19 19
20
21/*
22 *
23 * RPC service thread pool.
24 *
25 * Pool of threads and temporary sockets. Generally there is only
26 * a single one of these per RPC service, but on NUMA machines those
27 * services that can benefit from it (i.e. nfs but not lockd) will
28 * have one pool per NUMA node. This optimisation reduces cross-
29 * node traffic on multi-node NUMA NFS servers.
30 */
31struct svc_pool {
32 unsigned int sp_id; /* pool id; also node id on NUMA */
33 spinlock_t sp_lock; /* protects all fields */
34 struct list_head sp_threads; /* idle server threads */
35 struct list_head sp_sockets; /* pending sockets */
36 unsigned int sp_nrthreads; /* # of threads in pool */
37} ____cacheline_aligned_in_smp;
38
20/* 39/*
21 * RPC service. 40 * RPC service.
22 * 41 *
@@ -28,8 +47,6 @@
28 * We currently do not support more than one RPC program per daemon. 47 * We currently do not support more than one RPC program per daemon.
29 */ 48 */
30struct svc_serv { 49struct svc_serv {
31 struct list_head sv_threads; /* idle server threads */
32 struct list_head sv_sockets; /* pending sockets */
33 struct svc_program * sv_program; /* RPC program */ 50 struct svc_program * sv_program; /* RPC program */
34 struct svc_stat * sv_stats; /* RPC statistics */ 51 struct svc_stat * sv_stats; /* RPC statistics */
35 spinlock_t sv_lock; 52 spinlock_t sv_lock;
@@ -44,6 +61,9 @@ struct svc_serv {
44 61
45 char * sv_name; /* service name */ 62 char * sv_name; /* service name */
46 63
64 unsigned int sv_nrpools; /* number of thread pools */
65 struct svc_pool * sv_pools; /* array of thread pools */
66
47 void (*sv_shutdown)(struct svc_serv *serv); 67 void (*sv_shutdown)(struct svc_serv *serv);
48 /* Callback to use when last thread 68 /* Callback to use when last thread
49 * exits. 69 * exits.
@@ -138,6 +158,7 @@ struct svc_rqst {
138 int rq_addrlen; 158 int rq_addrlen;
139 159
140 struct svc_serv * rq_server; /* RPC service definition */ 160 struct svc_serv * rq_server; /* RPC service definition */
161 struct svc_pool * rq_pool; /* thread pool */
141 struct svc_procedure * rq_procinfo; /* procedure info */ 162 struct svc_procedure * rq_procinfo; /* procedure info */
142 struct auth_ops * rq_authop; /* authentication flavour */ 163 struct auth_ops * rq_authop; /* authentication flavour */
143 struct svc_cred rq_cred; /* auth info */ 164 struct svc_cred rq_cred; /* auth info */
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 7154e71c6d1f..4c296152cbfa 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -20,6 +20,7 @@ struct svc_sock {
20 struct socket * sk_sock; /* berkeley socket layer */ 20 struct socket * sk_sock; /* berkeley socket layer */
21 struct sock * sk_sk; /* INET layer */ 21 struct sock * sk_sk; /* INET layer */
22 22
23 struct svc_pool * sk_pool; /* current pool iff queued */
23 struct svc_serv * sk_server; /* service for this socket */ 24 struct svc_serv * sk_server; /* service for this socket */
24 atomic_t sk_inuse; /* use count */ 25 atomic_t sk_inuse; /* use count */
25 unsigned long sk_flags; 26 unsigned long sk_flags;