From: Paolo Abeni <pabeni@redhat.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, kraig@google.com, edumazet@google.com
Subject: Re: [RFC PATCH] reuseport: compute the ehash only if needed
Date: Thu, 14 Dec 2017 09:29:46 +0100 [thread overview]
Message-ID: <1513240186.2604.10.camel@redhat.com> (raw)
In-Reply-To: <20171213.150855.2054919319089098824.davem@davemloft.net>
Hi,
On Wed, 2017-12-13 at 15:08 -0500, David Miller wrote:
> From: Paolo Abeni <pabeni@redhat.com>
> Date: Tue, 12 Dec 2017 14:09:28 +0100
>
> > When a reuseport socket group is using a BPF filter to distribute
> > the packets among the sockets, we don't need to compute any hash
> > value, but the current reuseport_select_sock() requires the
> > caller to compute such hash in advance.
> >
> > This patch reworks reuseport_select_sock() to compute the hash value
> > only if needed - missing or failing BPF filter. Since different
> > hash functions have different argument types - ipv4 addresses vs ipv6
> > ones - to avoid over-complicate the interface, reuseport_select_sock()
> > is now a macro.
> >
> > Additionally, the sk_reuseport test is move inside reuseport_select_sock,
> > to avoid some code duplication.
> >
> > Overall this gives small but measurable performance improvement
> > under UDP flood while using SO_REUSEPORT + BPF.
> >
> > Signed-off-by: Paolo Abeni <pabeni@redhat.com>
>
> I don't doubt that this improves the case where the hash is elided, but
> I suspect it makes things slower othewise.
>
> You're doing two function calls for an operation that used to require
> just one in the bottom of the call chain.
>
> You're also putting something onto the stack that the compiler can't
> possibly optimize into purely using cpu registers to hold.
Thank you for the feedback.
I was unable to measure any performance regression for the hash based
demultiplexing, and I think that the number of function calls is
unchanged in such scenario (with vanilla kernel we have ehash() and
reuseport_select_sock(), with the patched one __reuseport_get_info()
and ehash()).
I agree you are right about the additional stack usage introduced by
this patch.
Overall I see we need something better than this.
Thanks,
Paolo
next prev parent reply other threads:[~2017-12-14 8:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-12 13:09 [RFC PATCH] reuseport: compute the ehash only if needed Paolo Abeni
2017-12-13 20:08 ` David Miller
2017-12-14 8:29 ` Paolo Abeni [this message]
2017-12-14 13:41 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2017-12-12 17:44 Craig Gallek
2017-12-12 18:25 ` Paolo Abeni
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=1513240186.2604.10.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kraig@google.com \
--cc=netdev@vger.kernel.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 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).