[lkml]   [2002]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: ip_conntrack_hash() problem
Just to make my previous statement clearer:

I think there's nothing wrong with a power-of-2 hashsize, as long as the
hash function contains no implicit or explicit multipliers that are also
powers of two. In general, multipliers should not have a greatest common
divisor (GCD) larger than 1 with the hash size. Unfortunately, in the
current implementation, ntohl() creates an implicit multiplier of 2^16
for the port numbers (on little-endian machines).


PS: For the sake of that, the patch also changed the multiplier for the
source port from 2 to 7, assuming that it's relatively unlikely to have
a hash size that is a multiple of 7, and knowing that multiplying by 7
is cheap. Instead of 7, 31 or 127 also seem good candidates that are
even more unlikely to be divisors of the hash size.

I recommend to printk() a warning if the hash size turns out to have a
GCD >1 with multiple of any multiplier in the hash function.

Martin Wilck Phone: +49 5251 8 15113
Fujitsu Siemens Computers Fax: +49 5251 8 20409
Heinz-Nixdorf-Ring 1
D-33106 Paderborn

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:28    [W:0.351 / U:0.864 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site