mbox series

[net-next,v3,0/2] Improve neigh_flush_dev performance

Message ID 20241010120139.2856603-1-gnaaman@drivenets.com (mailing list archive)
Headers show
Series Improve neigh_flush_dev performance | expand

Message

Gilad Naaman Oct. 10, 2024, 12:01 p.m. UTC
From: Gilad Naaman <gilad@naaman.io>

This patchsets improves the performance of neigh_flush_dev.

Currently, the only way to implement it requires traversing
all neighbours known to the kernel, across all network-namespaces.

This means that some flows are slowed down as a function of neighbour-scale,
even if the specific link they're handling has little to no neighbours.

In order to solve this, this patchset adds a netdev->neighbours list,
as well as making the original linked-list doubly-, so that it is
possible to unlink neighbours without traversing the hash-bucket to
obtain the previous neighbour.

The original use-case we encountered was mass-deletion of links (12K
VLANs) while there are 50K ARPs and 50K NDPs in the system; though the
slowdowns would also appear when the links are set down.

Changes in v3:

 - Fix rcu_torture failures (misusage of _protected)
 - Convert first/next access to for-each macros where appropriate

Gilad Naaman (2):
  Convert neighbour-table to use hlist
  Create netdev->neighbour association

 .../networking/net_cachelines/net_device.rst  |   1 +
 include/linux/netdevice.h                     |   6 +
 include/net/neighbour.h                       |  18 +-
 include/net/neighbour_tables.h                |  13 +
 net/core/neighbour.c                          | 272 ++++++++++--------
 5 files changed, 176 insertions(+), 134 deletions(-)
 create mode 100644 include/net/neighbour_tables.h