mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ralf Lici <ralf@mandelbit.com>
To: netdev-bot+sashiko@kernel.org
Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, willemb@google.com, horms@kernel.org,
	linux-kernel@vger.kernel.org, antonio@mandelbit.com
Subject: Re: [PATCH net-next 2/2] ipv6: allocate the flush serial under each table's lock
Date: Sun,  6 Dec 2026 11:25:32 +0100	[thread overview]
Message-ID: <20261206102533.195090-1-ralf@mandelbit.com> (raw)
In-Reply-To: <179647124393.3146.12155290401829441082@kernel.org>

On Sat, 05 Dec 2026 11:47:23 +0000, netdev-bot+sashiko@kernel.org wrote:
> > diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
> > --- a/net/ipv6/ip6_fib.c
> > +++ b/net/ipv6/ip6_fib.c
> > @@ -2344,8 +2347,10 @@ static void __fib6_clean_all(struct net *net,
> >  		head = &net->ipv6.fib_table_hash[h];
> >  		hlist_for_each_entry_rcu(table, head, tb6_hlist) {
> >  			spin_lock_bh(&table->tb6_lock);
> > -			fib6_clean_tree(net, &table->tb6_root,
> > -					func, sernum, arg, skip_notify);
> > +			if (sernum == FIB6_NEW_SERNUM)
> > +				table_sn = fib6_new_sernum(net);
> > +			fib6_clean_tree(net, &table->tb6_root, func,
> > +					table_sn, arg, skip_notify);
> >  			spin_unlock_bh(&table->tb6_lock);
> >  		}
> >  	}
>
> [Severity: Medium]
> This now advances net->ipv6.fib6_sernum once per table in
> fib_table_hash, where before it advanced once per flush. That counter
> is not only used for node stamps. rt_genid_ipv6() returns it directly,
> and nexthop-backed routes (f6i->nh != NULL) record it in
> pcpu_rt->sernum in ip6_rt_pcpu_alloc(). rt6_is_valid() then checks it
> with exact equality.
>
> So a single fib6_flush_trees() call can now invalidate every
> nexthop-backed dst up to T times, with a full fib6_clean_tree() walk
> between each bump.
>

Only lookups that run while the walk is in progress see the extra
advances. Holders check their dst lazily, so each one is invalidated once
per flush, and a lookup after the flush builds a dst that stays valid.

> Could the per-table allocation be skipped for tables that have nothing
> to stamp? Alternatively, fib6_flush_trees() could keep a single serial
> and have fib6_clean_node() leave alone nodes that already carry a
> newer one, once the age comparison lands later in the series. Either
> way, it would be good to mention the effect on nexthop dsts in the
> changelog.

Sashiko's second suggestion needs comparing serials by age, which the
follow-up series using these serials introduces, so I can switch to that
there if the per-table advance turns out to matter.

-- 
Ralf Lici
Mandelbit Srl

      reply	other threads:[~2026-12-06 10:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 11:28 [PATCH net-next 0/2] ipv6: keep fib6 node serials from going backwards Ralf Lici
2026-12-04 11:28 ` [PATCH net-next 1/2] ipv6: stamp the default route node with a fresh serial on link failure Ralf Lici
2026-12-05 11:47   ` netdev-bot+sashiko
2026-12-06 10:22     ` Ralf Lici
2026-12-04 11:28 ` [PATCH net-next 2/2] ipv6: allocate the flush serial under each table's lock Ralf Lici
2026-12-05 11:47   ` netdev-bot+sashiko
2026-12-06 10:25     ` Ralf Lici [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261206102533.195090-1-ralf@mandelbit.com \
    --to=ralf@mandelbit.com \
    --cc=antonio@mandelbit.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®