net/packet: better behavior under DDOS
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest8 patches 3 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | net/packet: constify __packet_get_status() argumentnet/ | +1 | 0 replies | |
| 2/8 | net/packet: constify packet_lookup_frame() and __tpacket_has_room()net/ | +7 | 0 replies | |
| 3/8 | net/packet: constify prb_lookup_block() and __tpacket_v3_has_room()net/ | +7 | 0 replies | |
| 4/8 | net/packet: constify __packet_rcv_has_room()net/ | +8 | 0 replies | |
| 5/8 | net/packet: make tp_drops atomicnet/ net/ | +12 | 0 replies | |
| 6/8 | net/packet: implement shortcut in tpacket_rcv()net/ | +6 | 0 replies | |
| 7/8 | net/packet: remove locking from packet_rcv_has_room()net/ | +9 | 0 replies | |
| 8/8 | net/packet: introduce packet_rcv_try_clear_pressure() helpernet/ | +9 | 1 reply |
Reviews trailers per patch
1 of 8 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Willem de Bruijn | Vinicius Costa Gomes |
|---|---|---|
| Series | A-b | |
| 1/8 | ||
| 2/8 | ||
| 3/8 | ||
| 4/8 | ||
| 5/8 | ||
| 6/8 | ||
| 7/8 | ||
| 8/8 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH net-next 0/8] net/packet: better behavior under DDOS
Using tcpdump (or other af_packet user) on a busy host can lead to catastrophic consequences, because suddenly, potentially all cpus are spinning on a contended spinlock.
Both packet_rcv() and tpacket_rcv() grab the spinlock to eventually find there is no room for an additional packet.
This patch series align packet_rcv() and tpacket_rcv() to both check if the queue is full before grabbing the spinlock.
If the queue is full, they both increment a new atomic counter placed on a separate cache line to let readers drain the queue faster.
There is still false sharing on this new atomic counter, we might in the future make it per cpu if there is interest.
Eric Dumazet (8):
net/packet: constify __packet_get_status() argument net/packet: constify packet_lookup_frame() and __tpacket_has_room() net/packet: constify prb_lookup_block() and __tpacket_v3_has_room() net/packet: constify __packet_rcv_has_room()
net/packet: make tp_drops atomic
net/packet: implement shortcut in tpacket_rcv() net/packet: remove locking from packet_rcv_has_room() net/packet: introduce packet_rcv_try_clear_pressure() helper
net/packet/af_packet.c | 96 ++++++++++++++++++++++++------------------ net/packet/internal.h | 1 + 2 files changed, 56 insertions(+), 41 deletions(-)
Signature · 1 line
2.22.0.rc2.383.gf4fbbf30c2-goog