* [PATCH 1/22] lockd: make NLM_HOST_MAX tunable
@ 2006-08-05 13:06 Olaf Kirch
2006-08-15 6:37 ` Neil Brown
0 siblings, 1 reply; 2+ messages in thread
From: Olaf Kirch @ 2006-08-05 13:06 UTC (permalink / raw)
To: nfs
From: Olaf Kirch <okir@suse.de>
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.
Signed-off-by: Olaf Kirch <okir@suse.de>
fs/lockd/host.c | 7 +++----
fs/lockd/svc.c | 10 ++++++++++
include/linux/lockd/lockd.h | 1 +
3 files changed, 14 insertions(+), 4 deletions(-)
Index: build/fs/lockd/svc.c
===================================================================
--- build.orig/fs/lockd/svc.c
+++ build/fs/lockd/svc.c
@@ -59,6 +59,7 @@ static DECLARE_WAIT_QUEUE_HEAD(lockd_exi
static 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 }
};
Index: build/include/linux/lockd/lockd.h
===================================================================
--- build.orig/include/linux/lockd/lockd.h
+++ build/include/linux/lockd/lockd.h
@@ -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
Index: build/fs/lockd/host.c
===================================================================
--- build.orig/fs/lockd/host.c
+++ build/fs/lockd/host.c
@@ -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 socka
INIT_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 - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/22] lockd: make NLM_HOST_MAX tunable
2006-08-05 13:06 [PATCH 1/22] lockd: make NLM_HOST_MAX tunable Olaf Kirch
@ 2006-08-15 6:37 ` Neil Brown
0 siblings, 0 replies; 2+ messages in thread
From: Neil Brown @ 2006-08-15 6:37 UTC (permalink / raw)
To: Olaf Kirch; +Cc: nfs
On Saturday August 5, okir@suse.de wrote:
> From: Olaf Kirch <okir@suse.de>
> 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.
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 - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-08-15 6:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-05 13:06 [PATCH 1/22] lockd: make NLM_HOST_MAX tunable Olaf Kirch
2006-08-15 6:37 ` Neil Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.