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

From: Evgeniy Polyakov <[email-masked]>
Date: Fri, 7 Nov 2008 20:25:38 +0300

On Fri, Nov 07, 2008 at 11:38:14AM -0500, Yavor Goulishev ([email-masked]) wrote:
> OK, but this is mainly achieved with good hash function and proper table size.
> My original patch wouldn't change the locations(buckets) of the ports. It will just chose different ports.
> The hack for picking a good port number just looks for empty bucket.

Your original patch just added full check into bucket selection
algorithm, so that you could jump into the next bucket early.

> > 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().
> 
> It would change. Switching the bucket allows you to grow the table size and keep O(1).
> Without changing the hash function, growing the table size will not help.
> Currently all binds on the same port will go to the same bucket.

Listen sockets have a priviledge to steal ports, so they can not be
accessed by any other bind, if you will distribute sockets with the
same port over the whole table, listen sockets will not caught this.

-- 
	Evgeniy Polyakov