netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, Simon Horman <horms@kernel.org>,
	eric.dumazet@gmail.com
Subject: Re: [PATCH net-next 0/4] net: reduce RTNL pressure in unregister_netdevice()
Date: Tue, 7 Jan 2025 12:11:48 -0800	[thread overview]
Message-ID: <20250107121148.7054518d@kernel.org> (raw)
In-Reply-To: <20250107173838.1130187-1-edumazet@google.com>

On Tue,  7 Jan 2025 17:38:34 +0000 Eric Dumazet wrote:
> One major source of RTNL contention resides in unregister_netdevice()
> 
> Due to RCU protection of various network structures, and
> unregister_netdevice() being a synchronous function,
> it is calling potentially slow functions while holding RTNL.
> 
> I think we can release RTNL in two points, so that three
> slow functions are called while RTNL can be used
> by other threads.

I think we'll need:

diff --git a/net/devlink/port.c b/net/devlink/port.c
index 939081a0e615..cdfa22453a55 100644
--- a/net/devlink/port.c
+++ b/net/devlink/port.c
@@ -1311,6 +1311,7 @@ int devlink_port_netdevice_event(struct notifier_block *nb,
 		__devlink_port_type_set(devlink_port, devlink_port->type,
 					netdev);
 		break;
+	case NETDEV_UNREGISTERING:
 	case NETDEV_UNREGISTER:
 		if (devlink_net(devlink) != dev_net(netdev))
 			return NOTIFY_OK;


There is no other way to speed things up? Use RT prio for the work?
Maybe WRITE_ONCE() a special handler into backlog.poll, and schedule it?

I'm not gonna stand in your way but in general re-taking caller locks
in a callee is a bit ugly :(

  parent reply	other threads:[~2025-01-07 20:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 17:38 [PATCH net-next 0/4] net: reduce RTNL pressure in unregister_netdevice() Eric Dumazet
2025-01-07 17:38 ` [PATCH net-next 1/4] net: no longer assume RTNL is held in flush_all_backlogs() Eric Dumazet
2025-01-07 17:38 ` [PATCH net-next 2/4] net: no longer hold RTNL while calling flush_all_backlogs() Eric Dumazet
2025-01-07 17:38 ` [PATCH net-next 3/4] net: expedite synchronize_net() for cleanup_net() Eric Dumazet
2025-01-09 17:42   ` kernel test robot
2025-01-09 18:14   ` kernel test robot
2025-01-07 17:38 ` [PATCH net-next 4/4] net: reduce RTNL hold duration in unregister_netdevice_many_notify() Eric Dumazet
2025-01-07 20:11 ` Jakub Kicinski [this message]
2025-01-07 20:22   ` [PATCH net-next 0/4] net: reduce RTNL pressure in unregister_netdevice() Eric Dumazet
2025-01-07 20:46     ` Eric Dumazet
2025-01-07 21:09       ` Jakub Kicinski

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=20250107121148.7054518d@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=horms@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).