Thread (15 messages) 15 messages, 4 authors, 1d ago

Re: [PATCH v4 net-next] net: neigh: avoid calling neigh_forced_gc on every alloc when table is full

From: Jakub Kicinski <kuba@kernel.org>
Date: 2026-07-21 21:09:12

On Wed, 15 Jul 2026 05:53:11 +0000 Vimal Agrawal wrote:
Once the neighbour table exceeds gc_thresh3, neigh_forced_gc() is called
on every allocation attempt with no rate limiting. In workloads with mostly
active/reachable entries, the GC walk traverses a large portion of the
neighbour table without reclaiming entries, holding tbl->lock for an
extended period. This causes severe lock contention and allocation
latencies exceeding 16ms under sustained neighbour creation.

Add a pre-lock check in neigh_forced_gc() to skip the GC run if one was
performed within the last 50 ms, but only when the table actually contains
NEIGH_FORCED_GC_LARGE_TABLE_THRESH (16384) or more entries. This avoids
repeated full table scans and lock acquisitions on the hot allocation path
while leaving tables with few entries completely unaffected regardless of
how gc_thresh3 is configured.
Hi Kuniyuki, are you still unconvinced by this?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help