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

Vimal Agrawal <[email protected]> Mon, 3 Aug 2026 19:21:05 +0530
Newsgroups org.kernel.vger.netdev
Message-ID <CALkUMdQY+i6yQYLb2VqVeN2fFTWMpRa8Vufr4gGGUxSQh5dhyg@mail.gmail.com>
Hi Kuniyuki,

Can you please check if this is fine with you or if you have any more comments?

Thanks,
Vimal

On Sat, Jul 25, 2026 at 4:48 AM Jakub Kicinski <[email protected]> wrote:
>
> On Tue, 21 Jul 2026 14:09:11 -0700 Jakub Kicinski wrote:
> > 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?
>
> Looks like Kuniyuki is AFK, please repost this in a week (Aug 2nd?)
> This patch is the oldest in our queue and it's getting close to
> the auto-discard threshold of 2 weeks.