All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: yoshfuji@linux-ipv6.org
Cc: netfilter-devel@lists.netfilter.org, kaber@trash.net,
	yasuyuki.kozakai@toshiba.co.jp
Subject: Re: [PATCH] nf_conntrack: optimize hash calculation of tuple
Date: Fri, 26 May 2006 15:51:39 +0200	[thread overview]
Message-ID: <447707EB.7000401@trash.net> (raw)
In-Reply-To: <20060526.224556.19965528.yoshfuji@linux-ipv6.org>

YOSHIFUJI Hideaki / ^[$B5HF#1QL@^[ wrote:
> In article <447703F2.90401@trash.net> (at Fri, 26 May 2006 15:34:42 +0200), Patrick McHardy <kaber@trash.net> says:
> 
> 
> 
>>>+	return c % size;
>>> }
>>
>>
>>That still looks pretty expensive. Is there a reason why you didn't
>>just add/xor/or/... the individual values until you get down to
>>three and then use jhash_3words? We could also get rid of the modula
>>operation by making sure the hash-size is always a power of 2.
> 
> 
> I disagree.  Suhc oprations are not good for randomness.
> And, gcc is cleaver enough to convert it to shift operation.


Assuming you're talking the modula operation: gcc can't do that,
a modula operation can only be represented by a shift for a small
subset of the possible values. The randomness is provided by
jhash + the initial random value. If we rely on randomness by
some assumption about the hash size our code is already broken.
But anyway, this is just a possible micro-optimization, the
real question is why we need three invocations of jhash_mix.

  reply	other threads:[~2006-05-26 13:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-26  0:15 [PATCH] nf_conntrack: optimize hash calculation of tuple Yasuyuki KOZAKAI
2006-05-26 13:34 ` Patrick McHardy
2006-05-26 13:45   ` YOSHIFUJI Hideaki / 吉藤英明
2006-05-26 13:51     ` Patrick McHardy [this message]
2006-05-26 14:17       ` YOSHIFUJI Hideaki / 吉藤英明
2006-05-26 15:04       ` Yasuyuki KOZAKAI
     [not found]       ` <200605261504.k4QF4InW014648@toshiba.co.jp>
2006-05-26 17:54         ` Patrick McHardy
2006-05-29  0:25           ` Yasuyuki KOZAKAI
     [not found]           ` <200605290025.k4T0PeSE014151@toshiba.co.jp>
2006-05-29  1:27             ` Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=447707EB.7000401@trash.net \
    --to=kaber@trash.net \
    --cc=netfilter-devel@lists.netfilter.org \
    --cc=yasuyuki.kozakai@toshiba.co.jp \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.