Skip to content

net-sysfs: remove the rtnl_trylock/restart_syscall construction

Antoine Tenart netdev 2 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 2 repliesApplied 4/4
  2. v14 patches 10 repliesSuperseded

Patches in v2 All 4 applied

#Subject and filesSizeRepliesApplied
1/4net-sysfs: remove rtnl_trylock from device attributesinclude/linux/rtnetlink.h net/core/net-sysfs.c net/core/rtnetlink.c+139 -532 repliesApplied
2/4net-sysfs: move queue attribute groups outside the default groupsinclude/linux/netdevice.h include/net/netdev_rx_queue.h net/core/net-sysfs.c+23 -60 repliesApplied
3/4net-sysfs: prevent uncleared queues from being re-addednet/core/net-sysfs.c+32 -00 repliesApplied
4/4net-sysfs: remove rtnl_trylock from queue attributesnet/core/net-sysfs.c+89 -580 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH net-next v2 0/4] net-sysfs: remove the rtnl_trylock/restart_syscall construction

Hi,

The series initially aimed at improving spins (and thus delays) while accessing net sysfs under rtnl lock contention[1]. The culprit was the trylock/restart_syscall constructions. There wasn't much interest at the time but it got traction recently for other reasons (lowering the rtnl lock pressure).

Since v1[2]:

- Do not export rtnl_lock_interruptible [Stephen].
- Add netdev_warn_once messages in rx_queue_add_kobject [Jakub].

Since the RFC[1]:

- Limit the breaking of the sysfs protection to sysfs_rtnl_lock() only as this is not needed in the whole rtnl locking section thanks to the additional check on dev_isalive(). This simplifies error handling as well as the unlocking path.
- Used an interruptible version of rtnl_lock, as done by Jakub in his experiments.
- Removed a WARN_ONCE_ONCE [Greg].
- Removed explicit inline markers [Stephen].

Most of the reasoning is explained in comments added in patch 1. This was tested by stress-testing net sysfs attributes (read/write ops) while adding/removing queues and adding/removing veths, all in parallel. I also used an OCP single node cluster, spawning lots of pods.

Thanks,
Antoine

[1] https://lore.kernel.org/all/[email protected]/T/
[2] https://lore.kernel.org/all/[email protected]/T/

Antoine Tenart (4):
net-sysfs: remove rtnl_trylock from device attributes
net-sysfs: move queue attribute groups outside the default groups
net-sysfs: prevent uncleared queues from being re-added
net-sysfs: remove rtnl_trylock from queue attributes

 include/linux/netdevice.h     |   1 +
 include/linux/rtnetlink.h     |   1 +
 include/net/netdev_rx_queue.h |   1 +
 net/core/net-sysfs.c          | 392 ++++++++++++++++++++++++----------
 net/core/rtnetlink.c          |   5 +
 5 files changed, 283 insertions(+), 117 deletions(-)
Signature · 1 line
2.48.1