svn commit: r243594 - head/sys/netinet
Alfred Perlstein
bright at mu.org
Wed Nov 28 03:04:44 UTC 2012
On 11/27/12 2:12 PM, Andre Oppermann wrote:
> On 27.11.2012 04:04, Alfred Perlstein wrote:
>> Author: alfred
>> Date: Tue Nov 27 03:04:24 2012
>> New Revision: 243594
>> URL: http://svnweb.freebsd.org/changeset/base/243594
>>
>> Log:
>> Auto size the tcbhashsize structure based on max sockets.
>>
>> While here, also make the code that enforces power-of-two more
>> forgiving, instead of just resetting to 512, graciously round-down
>> to the next lower power of two.
>
> The porthash (also a parameter to in_pcbinfo_init()) should not be
> scaled the same as tcbhashsize. It's unlikely that anyone is going
> to have more than a thousand listen ports.
>
> The default tcbhashsize scaling factor of maxsockets / 4 is IMHO
> excessive. If someone is running at the limit he's going to up
> maxsockets to double the target load. Dividing by 8 is a better
> balance for normal and well used large memory machines.
> The hashsize calculation logic is done a bit in a roundabout way.
>
> What do think of the attached patch to fix the porthash and to simplify
> the hashsize logic?
>
I like the porthash fix.
However your change:
1) removes explanation of what the code is doing. (comments/clarity)
2) removes the more forgiving code that rounds-down the tcp_tcbhashsize.
Can you please maintain the comments (probably keeping the logic of
maketcp_hashsize() in a separate function).
Can you please maintain the more forgiving code for dealing with
non-power of 2 tunable? I like this, it makes it easier for admins and
less error prone.
- if (!powerof2(hashsize)) {
- int oldhashsize = hashsize;
- hashsize = maketcp_hashsize(hashsize);
- /* prevent absurdly low value */
- if (hashsize < 16)
- hashsize = 16;
- printf("%s: WARNING: TCB hash size not a power of 2, "
- "clipped from %d to %d.\n", __func__, oldhashsize,
- hashsize);
More information about the svn-src-head
mailing list