lockd: make NLM_HOST_MAX tunable
Subsystems (2)
PATCH 1/22 lockd: make NLM_HOST_MAX tunable
From: Olaf Kirch <[email protected]>
Subject: lockd: make NLM_HOST_MAX tunable
Patch-mainline: not-yet
This patch makes NLM_HOST_MAX tunable, and exports the new variable as a sysctl.
The old value (64 clients) just wasn't adequate anymore.
fs/lockd/host.c | 7 +++---- fs/lockd/svc.c | 10 ++++++++++ include/linux/lockd/lockd.h | 1 + 3 files changed, 14 insertions(+), 4 deletions(-)
fs/lockd/svc.c +10 -0
@@ -59,6 +59,7 @@ static DECLARE_WAIT_QUEUE_HEAD(lockd_existatic unsigned long nlm_grace_period;static unsigned long nlm_timeout =LOCKD_DFLT_TIMEO ;static int nlm_udpport, nlm_tcpport; +int nlm_max_hosts =256 ;/* * Constants needed for the sysctl interface.
@@ -367,6 +368,15 @@ static ctl_table nlm_sysctls[] = { .extra1 = (int *) &nlm_port_min, .extra2 = (int *) &nlm_port_max, }, + { + .ctl_name = CTL_UNNUMBERED, + .procname = "nlm_max_hosts", + .data = &nlm_max_hosts, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec, + }, + { .ctl_name = 0 } };
include/linux/lockd/lockd.h +1 -0
@@ -144,6 +144,7 @@ extern struct svc_procedure nlmsvc_proce#endif extern int nlmsvc_grace_period;extern unsigned long nlmsvc_timeout; +extern int nlm_max_hosts;/* * Lockd client functions
fs/lockd/host.c +3 -4
@@ -20,12 +20,11 @@#define NLMDBG_FACILITY NLMDBG_HOSTCACHE -#define NLM_HOST_MAX 64#define NLM_HOST_NRHASH 32#define NLM_ADDRHASH (addr) (ntohl(addr) & (NLM_HOST_NRHASH-1))#define NLM_HOST_REBIND (60 * HZ) -#define NLM_HOST_EXPIRE ((nrhosts > NLM_HOST_MAX)? 300 * HZ : 120 * HZ) -#define NLM_HOST_COLLECT ((nrhosts > NLM_HOST_MAX)? 120 * HZ : 60 * HZ) +#define NLM_HOST_EXPIRE ((nrhosts > nlm_max_hosts)? 300 * HZ : 120 * HZ) +#define NLM_HOST_COLLECT ((nrhosts > nlm_max_hosts)? 120 * HZ : 60 * HZ)#define NLM_HOST_ADDR (sv) (&(sv)->s_nlmclnt->cl_xprt->addr)static struct nlm_host * nlm_hosts[NLM_HOST_NRHASH ];
@@ -128,7 +127,7 @@ nlm_lookup_host(int server, struct sockaINIT_LIST_HEAD (&host->h_granted);INIT_LIST_HEAD (&host->h_reclaim); -if (++nrhosts >NLM_HOST_MAX ) +if (++nrhosts > nlm_max_hosts) next_gc =0 ; nohost:
-------------------------------------------------------------------------
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
Quoted 7 lines · On Saturday August 5, [email protected] wrote:
From: Olaf Kirch <[email protected]>
Subject: lockd: makeNLM_HOST_MAXtunable
Patch-mainline: not-yetThis patch makes
NLM_HOST_MAXtunable, and exports the new variable as a sysctl.
The old value (64 clients) just wasn't adequate anymore.
Why do we need NLM_HOST_MAX at all? And if we do, we need a better name, because it isn't really a maximum.
It is more of a threshold.
While there are fewer than this mean, we garbage collect every 2 minutes discarding hosts more than 5 minutes old.
When we exceed this threshold, we garbage collect every minutes (or every time a new host is allocated). and discard hosts older than 2 minutes.
It seems like we are picking an arbitrary point at which to switch from one arbitrary algorithm to another. Do we really want to do this?
I cannot see any good reason not to just pick one arbitrary algorithm and stick with that the whole time.
The only tunable might make sense is the max age before garbage collection removes hosts.
Am I missing something important?
NeilBrown
-------------------------------------------------------------------------
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