[Midnightbsd-cvs] src [8315] trunk/sys/netinet/tcp_hostcache.c: update cachelimit after hashzie and bucketlimit were set
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Sep 17 18:33:45 EDT 2016
Revision: 8315
http://svnweb.midnightbsd.org/src/?rev=8315
Author: laffer1
Date: 2016-09-17 18:33:45 -0400 (Sat, 17 Sep 2016)
Log Message:
-----------
update cachelimit after hashzie and bucketlimit were set
Modified Paths:
--------------
trunk/sys/netinet/tcp_hostcache.c
Modified: trunk/sys/netinet/tcp_hostcache.c
===================================================================
--- trunk/sys/netinet/tcp_hostcache.c 2016-09-17 22:33:15 UTC (rev 8314)
+++ trunk/sys/netinet/tcp_hostcache.c 2016-09-17 22:33:45 UTC (rev 8315)
@@ -174,6 +174,7 @@
void
tcp_hc_init(void)
{
+ u_int cache_limit;
int i;
/*
@@ -182,17 +183,11 @@
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 */
@@ -199,6 +194,16 @@
}
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 Midnightbsd-cvs
mailing list