Subject: Re: [Patch] Establishing more than 64K outgoing TCP connections

From: Evgeniy Polyakov <[email-masked]>
Date: Fri, 7 Nov 2008 11:45:55 +0300

On Fri, Nov 07, 2008 at 01:57:34AM -0500, Yavor Goulishev ([email-masked]) wrote:
> I'm suggesting a solution different from my original patch.
> To overcome the limit and preserver the current properties you can
> just change the hash function and the the table size.
> This is just an idea.

You can use bindtodevice and reuseaddr socket options already.

> The current hash is only the port number.
> Not sure why you want linear access in a hash table though:
>   >  I'm asking for O(num_ports_bound / hash_table_size) access.
> What is this? Searching for unused port number?
> It would stay the same if you use "(port + ip) % size".

When sockets (hash results) are evenly distributed over the hash table,
access will be O(num_of_elemets / hash_table_size), with particulary big
table it will be O(1).

If you will add any other fields into hash in inet_csk_get_port(), this
will not change anything, since it will just switch hash table bucket to
be checked. When we found hash bucket for given port, all its entries
are checked to have the same parameters as in provided data. See how
bind_conflict() callback is invoked in inet_csk_get_port().

-- 
	Evgeniy Polyakov