linux/tools
Willem de Bruijn 77f65ebdca packet: packet fanout rollover during socket overload
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 psock_fanout.c unit test added to selftests.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-19 17:15:04 -04:00
..
cgroup cgroups: fix cgroup_event_listener error handling 2013-01-08 10:00:44 -08:00
firewire tools/firewire: nosy-dump: check for allocation failure 2012-12-02 20:10:18 +01:00
hv tools: hv: Use CLOEXEC when opening kvp_pool files 2013-01-18 16:03:34 -08:00
include/tools tools/include: Add byteshift headers for endian access 2012-02-28 10:22:51 -08:00
lguest tools/lguest: remove depends on CONFIG_EXPERIMENTAL 2013-01-11 11:40:03 -08:00
lib/traceevent tools lib traceevent: Handle dynamic array's element size properly 2013-01-25 12:49:28 -03:00
nfsd NFSD: Added fault injection script 2011-11-07 21:10:47 -05:00
perf ImgTec Meta architecture changes for v3.9-rc1 2013-03-03 12:06:09 -08:00
power Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux 2013-02-18 22:34:11 +01:00
scripts tools: Pass the target in descend 2012-11-19 22:10:36 +00:00
testing packet: packet fanout rollover during socket overload 2013-03-19 17:15:04 -04:00
usb testusb: remove all mentions of 'usbfs' 2013-02-08 12:15:24 -08:00
virtio Some nice cleanups, and even a patch my wife did as a "live" demo for 2012-12-20 08:37:05 -08:00
vm tools/vm: add .gitignore to ignore built binaries 2013-02-05 20:38:46 +11:00
Makefile Merge branch 'for-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup 2013-02-20 09:16:21 -08:00