From: Eric Dumazet <eric.dumazet@gmail.com>
To: Willem de Bruijn <willemb@google.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v3] packet: packet fanout rollover during socket overload
Date: Tue, 19 Mar 2013 13:37:17 -0700 [thread overview]
Message-ID: <1363725437.2558.22.camel@edumazet-glaptop> (raw)
In-Reply-To: <1363724291-27580-1-git-send-email-willemb@google.com>
On Tue, 2013-03-19 at 16:18 -0400, Willem de Bruijn wrote:
> Changes:
> v3->v2: rebase (no other changes)
> passes selftest
> v2->v1: read f->num_members only once
> fix bug: test rollover mode + flag
>
> Minimize packet drop in a fanout group. If one socket is full,
> roll over packets to another from the group. Maintain flow
> affinity during normal load using an rxhash fanout policy, while
> dispersing unexpected traffic storms that hit a single cpu, such
> as spoofed-source DoS flows. Rollover breaks affinity for flows
> arriving at saturated sockets during those conditions.
>
> The patch adds a fanout policy ROLLOVER that rotates between sockets,
> filling each socket before moving to the next. It also adds a fanout
> flag ROLLOVER. If passed along with any other fanout policy, the
> primary policy is applied until the chosen socket is full. Then,
> rollover selects another socket, to delay packet drop until the
> entire system is saturated.
>
> Probing sockets is not free. Selecting the last used socket, as
> rollover does, is a greedy approach that maximizes chance of
> success, at the cost of extreme load imbalance. In practice, with
> sufficiently long queues to absorb bursts, sockets are drained in
> parallel and load balance looks uniform in `top`.
>
> To avoid contention, scales counters with number of sockets and
> accesses them lockfree. Values are bounds checked to ensure
> correctness.
>
> Tested using an application with 9 threads pinned to CPUs, one socket
> per thread and sufficient busywork per packet operation to limits each
> thread to handling 32 Kpps. When sent 500 Kpps single UDP stream
> packets, a FANOUT_CPU setup processes 32 Kpps in total without this
> patch, 270 Kpps with the patch. Tested with read() and with a packet
> ring (V1). Also, passes unit test (perhaps for selftests) at
> http://kernel.googlecode.com/files/psock_fanout.c
>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
> ---
> include/uapi/linux/if_packet.h | 2 +
> net/packet/af_packet.c | 109 ++++++++++++++++++++++++++++++++---------
> net/packet/internal.h | 3 +-
> 3 files changed, 90 insertions(+), 24 deletions(-)
Reviewed-by: Eric Dumazet <edumazet@google.com>
next prev parent reply other threads:[~2013-03-19 20:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-19 20:18 [PATCH net-next v3] packet: packet fanout rollover during socket overload Willem de Bruijn
2013-03-19 20:37 ` Eric Dumazet [this message]
2013-03-19 21:16 ` David Miller
2013-03-19 21:34 ` Willem de Bruijn
2013-03-20 6:37 ` Willem de Bruijn
2013-03-20 6:42 ` [PATCH net-next] net: fix psock_fanout selftest hash collision Willem de Bruijn
2013-03-20 16:33 ` David Miller
2013-03-20 17:59 ` David Miller
2013-03-21 0:07 ` Willem de Bruijn
2013-03-21 1:16 ` David Miller
2013-03-21 6:31 ` Daniel Borkmann
2013-03-21 17:27 ` Willem de Bruijn
2013-03-21 17:46 ` David Miller
2013-03-21 17:47 ` Daniel Borkmann
2013-03-21 18:00 ` Willem de Bruijn
2013-03-21 17:49 ` David Miller
2013-03-21 17:56 ` David Miller
2013-03-21 18:01 ` Willem de Bruijn
2013-03-21 18:10 ` [PATCH net-next] net: fix psock_fanout on sparc64 Willem de Bruijn
2013-03-21 18:31 ` David Miller
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=1363725437.2558.22.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=willemb@google.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