From: Ido Schimmel <idosch@nvidia.com>
To: Eric Dumazet <edumazet@google.com>, lirongqing@baidu.com
Cc: David Ahern <dsahern@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH][net-next] net: vrf: switch to synchronize_net() when releasing routes
Date: Wed, 11 Mar 2026 17:26:13 +0200 [thread overview]
Message-ID: <20260311152613.GA2441293@shredder> (raw)
In-Reply-To: <CANn89i+PK6N0VJPQ_NtvHFizpnnrWb9AOPz=M0WyzsQGogsUpQ@mail.gmail.com>
On Wed, Mar 11, 2026 at 02:26:57PM +0100, Eric Dumazet wrote:
> On Wed, Mar 11, 2026 at 2:19 PM Ido Schimmel <idosch@nvidia.com> wrote:
> >
> > On Tue, Mar 10, 2026 at 06:53:31AM -0400, lirongqing wrote:
> > > From: Li RongQing <lirongqing@baidu.com>
> > >
> > > Replace synchronize_rcu() with synchronize_net() in vrf_rtable_release()
> > > and vrf_rt6_release().
> > >
> > > synchronize_net() is RTNL-aware and can use the more efficient
> > > synchronize_rcu_expedited() when the RTNL lock is held, avoiding
> > > potentially long wait times for a standard RCU grace period.
> > >
> > > Since these release functions are called during device teardown where
> > > the RTNL lock is typically held, this change reduces the time spent
> > > in RTNL critical sections and speeds up VRF device deletion.
> > >
> > > Signed-off-by: Li RongQing <lirongqing@baidu.com>
> > > ---
> > > drivers/net/vrf.c | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
> > > index 8c009bc..92a0f4b 100644
> > > --- a/drivers/net/vrf.c
> > > +++ b/drivers/net/vrf.c
> > > @@ -755,7 +755,7 @@ static void vrf_rt6_release(struct net_device *dev, struct net_vrf *vrf)
> > > struct dst_entry *dst;
> > >
> > > RCU_INIT_POINTER(vrf->rt6, NULL);
> > > - synchronize_rcu();
> > > + synchronize_net();
> >
> > I might be missing something, but why do we need synchronize_rcu() here?
> > The code below calls dst_release() which will only free the dst entry
> > after an RCU grace period (assuming we dropped the last reference).
>
> Agreed, this could/should have been removed after
>
> commit 4f04256c983a4f115417d2009b44dcb7d70a6375
> Author: David Ahern <dsahern@gmail.com>
> Date: Fri Aug 11 17:11:14 2017 -0700
>
> net: vrf: Drop local rtable and rt6_info
>
> The VRF cached rtable and rt6_info for local traffic are no longer
> needed and actually prevent local traffic through enslaved devices.
> Remove them.
>
>
>
> >
> > Also, I think that instead of using net->loopback_dev the code can be
> > converted to use dst_dev_put() before dst_release().
> >
>
> Maybe in a separate patch ;)
Yes, separate patch. Another thing that can be simplified in this area
is the NULL check in vrf_rtable_release(). I don't see how that can
happen. It is necessary in the case of vrf_rt6_release() due to
'ipv6.disable=1'.
Li RongQing, can you take care of these changes?
1. Remove NULL check in vrf_rtable_release().
2. Convert vrf_rtable_release() and vrf_rt6_release() to use
dst_dev_put() before dst_release(), instead of using
'net->loopback_dev'.
3. Remove synchronize_rcu() from both vrf_rtable_release() and
vrf_rt6_release().
Thanks
prev parent reply other threads:[~2026-03-11 15:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 10:53 [PATCH][net-next] net: vrf: switch to synchronize_net() when releasing routes lirongqing
2026-03-11 13:19 ` Ido Schimmel
2026-03-11 13:26 ` Eric Dumazet
2026-03-11 15:26 ` Ido Schimmel [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=20260311152613.GA2441293@shredder \
--to=idosch@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=lirongqing@baidu.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.