mbox series

[net-next,0/4] net-sysfs: remove the rtnl_trylock/restart_syscall construction

Message ID 20250117102612.132644-1-atenart@kernel.org (mailing list archive)
Headers show
Series net-sysfs: remove the rtnl_trylock/restart_syscall construction | expand

Message

Antoine Tenart Jan. 17, 2025, 10:26 a.m. UTC
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 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 call [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/20231018154804.420823-1-atenart@kernel.org/T/

---

Not sending this as an RFC as I believe this is ready for proper review,
but also note rc7 is there already and we might want this to live for a
bit in net-next before getting to Linus' tree.

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          | 388 ++++++++++++++++++++++++----------
 net/core/rtnetlink.c          |   6 +
 5 files changed, 280 insertions(+), 117 deletions(-)