svn commit: r242375 - stable/9/sys/netinet
Andrey Zonov
zont at FreeBSD.org
Tue Oct 30 21:04:13 UTC 2012
Author: zont
Date: Tue Oct 30 21:04:12 2012
New Revision: 242375
URL: http://svn.freebsd.org/changeset/base/242375
Log:
MFC r241735:
- Update cachelimit after hashsize and bucketlimit were set.
Approved by: kib (mentor)
Modified:
stable/9/sys/netinet/tcp_hostcache.c
Directory Properties:
stable/9/sys/ (props changed)
Modified: stable/9/sys/netinet/tcp_hostcache.c
==============================================================================
--- stable/9/sys/netinet/tcp_hostcache.c Tue Oct 30 21:00:46 2012 (r242374)
+++ stable/9/sys/netinet/tcp_hostcache.c Tue Oct 30 21:04:12 2012 (r242375)
@@ -174,6 +174,7 @@ static MALLOC_DEFINE(M_HOSTCACHE, "hostc
void
tcp_hc_init(void)
{
+ u_int cache_limit;
int i;
/*
@@ -182,23 +183,27 @@ tcp_hc_init(void)
V_tcp_hostcache.cache_count = 0;
V_tcp_hostcache.hashsize = TCP_HOSTCACHE_HASHSIZE;
V_tcp_hostcache.bucket_limit = TCP_HOSTCACHE_BUCKETLIMIT;
- V_tcp_hostcache.cache_limit =
- V_tcp_hostcache.hashsize * V_tcp_hostcache.bucket_limit;
V_tcp_hostcache.expire = TCP_HOSTCACHE_EXPIRE;
V_tcp_hostcache.prune = TCP_HOSTCACHE_PRUNE;
TUNABLE_INT_FETCH("net.inet.tcp.hostcache.hashsize",
&V_tcp_hostcache.hashsize);
- TUNABLE_INT_FETCH("net.inet.tcp.hostcache.cachelimit",
- &V_tcp_hostcache.cache_limit);
- TUNABLE_INT_FETCH("net.inet.tcp.hostcache.bucketlimit",
- &V_tcp_hostcache.bucket_limit);
if (!powerof2(V_tcp_hostcache.hashsize)) {
printf("WARNING: hostcache hash size is not a power of 2.\n");
V_tcp_hostcache.hashsize = TCP_HOSTCACHE_HASHSIZE; /* default */
}
V_tcp_hostcache.hashmask = V_tcp_hostcache.hashsize - 1;
+ TUNABLE_INT_FETCH("net.inet.tcp.hostcache.bucketlimit",
+ &V_tcp_hostcache.bucket_limit);
+
+ cache_limit = V_tcp_hostcache.hashsize * V_tcp_hostcache.bucket_limit;
+ V_tcp_hostcache.cache_limit = cache_limit;
+ TUNABLE_INT_FETCH("net.inet.tcp.hostcache.cachelimit",
+ &V_tcp_hostcache.cache_limit);
+ if (V_tcp_hostcache.cache_limit > cache_limit)
+ V_tcp_hostcache.cache_limit = cache_limit;
+
/*
* Allocate the hash table.
*/
More information about the svn-src-stable-9
mailing list