[Cake] Fwd: curious about hashing comments on cake

Jonathan Morton chromatix99 at gmail.com
Fri Jan 8 16:15:56 EST 2016

> On http://www.bufferbloat.net/projects/codel/wiki/CakeTechnical, it
> says that the hash used by fq_codel had various issues and that "we
> have also found that the hash function fq_codel relies on is
> suboptimal."  I believe that fq_codel uses the Jenkins hash like many
> other parts of linux.  What was suboptimal about it?  The page notes
> the birthday problem but was there anything else?

In some tests, we were seeing a higher rate of collisions than even the birthday theorem would predict.  That generally points to a hash function insufficiently indistinguishable from white noise, at least when truncated for use in a small table.

I don’t think there’s anything fundamentally wrong with the Jenkins hash, but there are possibly limitations with the input conditioning, especially with IPv6 addresses.

Cake does still use the Jenkins hash directly when compiled for older kernels, but that’s a backwards compatibility measure.  For newer kernels, Cake uses whichever hash function is supplied as part of the new flow-dissection API.  It strikes me that this would probably be updated in future if a serious weakness was discovered, and probably uses better input conditioning than the old system.

The birthday paradox is the big one, though, and this is what the set-associative hash function addresses directly.

 - Jonathan Morton

More information about the Cake mailing list