From: "Maciej Żenczykowski" <zenczykowski@gmail.com>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
Florian Westphal <fw@strlen.de>, Changli Gao <xiaosuo@gmail.com>,
Patrick McHardy <kaber@trash.net>,
netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: remove modulo operations
Date: Sun, 24 Oct 2010 20:19:31 -0700 [thread overview]
Message-ID: <AANLkTimqOaBx4hr4RiuBQW-JePcf4QScMP56p20eTtF5@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.01.1010242222380.18070@obet.zrqbmnf.qr>
> To be read as: one OV is reachable by 13 input values; 5 OVs are each
> reachable by 12 input values (IV) (i.e. a group of 60 IV lead to only 5
> OV), etc.
I don't quite follow what you are doing here.
> You can surely agree with me that this looks very much like at least
> one queue will be at a disadvantage (getting less packets).
>
> And indeed, with total_queues=4 I get a packet distribution of
>
> 24.41404 25.58534 25.00025 25.00037
>
> percent. With more queues, I suspect the variance will go up.
This suggests the hash function is bad.
The only difference between
HASH32 % N
and
(HASH32 * N) >> 32
is that modulus has a tendency to use the lower bits of the HASH32,
while multiplication has a tendency to use the higher bits of the
HASH32.
Non-prime values of N will be worse than prime values (excluding two),
and power-of-two values of N will be worst.
If the HASH32 is being calculated as SRC_IP^DST_IP, and then we're
using a power-of-two value of N, then we're basically using the top
two (for N=4)
bits of SRC_IP^DST_IP, which has a bad distribution for obvious
reasons - namely, ips aren't randomly distributed, especially so for
their top two bits.
Remember entire /8's haven't been allocated, the entire top /3 is
multicast or reserved. And certain /8's (like 10.*) are much more
likely than others (0.*).
It certainly seems that the hash function should be fixed.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-10-25 3:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-24 3:40 [PATCH] netfilter: remove modulo operations Changli Gao
2010-10-24 18:25 ` Florian Westphal
2010-10-24 19:11 ` Eric Dumazet
2010-10-24 20:44 ` Florian Westphal
2010-10-24 21:49 ` Maciej Żenczykowski
2010-10-25 3:02 ` Jan Engelhardt
2010-10-25 3:19 ` Maciej Żenczykowski [this message]
2010-10-25 9:13 ` Jan Engelhardt
2010-10-25 9:28 ` Jan Engelhardt
2010-10-25 9:26 ` Eric Dumazet
2010-10-25 15:39 ` 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=AANLkTimqOaBx4hr4RiuBQW-JePcf4QScMP56p20eTtF5@mail.gmail.com \
--to=zenczykowski@gmail.com \
--cc=eric.dumazet@gmail.com \
--cc=fw@strlen.de \
--cc=jengelh@medozas.de \
--cc=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=xiaosuo@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).