Date: Tue, 30 Oct 2012 21:05:06 +0000 (UTC) From: Andrey Zonov <zont@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r242377 - stable/8/sys/netinet Message-ID: <201210302105.q9UL56RM075766@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: zont Date: Tue Oct 30 21:05:06 2012 New Revision: 242377 URL: http://svn.freebsd.org/changeset/base/242377 Log: MFC r241735: - Update cachelimit after hashsize and bucketlimit were set. Approved by: kib (mentor) Modified: stable/8/sys/netinet/tcp_hostcache.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/tcp_hostcache.c ============================================================================== --- stable/8/sys/netinet/tcp_hostcache.c Tue Oct 30 21:04:16 2012 (r242376) +++ stable/8/sys/netinet/tcp_hostcache.c Tue Oct 30 21:05:06 2012 (r242377) @@ -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. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210302105.q9UL56RM075766>