Skip to content

inet_diag: remove three mutexes in diag dumps

Eric Dumazet netdev 1 version 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

  1. v1 Latest9 patches 18 repliesApplied 9/9

Patches in v1 All 9 applied

#Subject and filesSizeRepliesApplied
1/9sock_diag: annotate data-races around sock_diag_handlers[family]net/core/sock_diag.c+5 -52 repliesApplied
2/9inet_diag: annotate data-races around inet_diag_table[]net/ipv4/inet_diag.c+3 -32 repliesApplied
3/9inet_diag: add module pointer to "struct inet_diag_handler"include/linux/inet_diag.h net/dccp/diag.c net/ipv4/raw_diag.c +4 more+8 -02 repliesApplied
4/9inet_diag: allow concurrent operationsnet/ipv4/inet_diag.c+40 -402 repliesApplied
5/9sock_diag: add module pointer to "struct sock_diag_handler"include/linux/sock_diag.h net/ipv4/inet_diag.c net/netlink/diag.c +6 more+10 -02 repliesApplied
6/9sock_diag: allow concurrent operationsnet/core/sock_diag.c+42 -312 repliesApplied
7/9sock_diag: allow concurrent operation in sock_diag_rcv_msg()include/linux/sock_diag.h net/core/sock_diag.c net/ipv4/inet_diag.c+40 -212 repliesApplied
8/9sock_diag: remove sock_diag_mutexnet/core/sock_diag.c+0 -42 repliesApplied
9/9inet_diag: skip over empty bucketsnet/ipv4/inet_diag.c+8 -02 repliesApplied

Reviews trailers per patch

All 9 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchWillem de BruijnGuillaume NaultKuniyuki Iwashima
SeriesR-b
1/9R-b R-b
2/9R-b R-b
3/9R-b R-b
4/9R-b R-b
5/9R-b R-b
6/9R-b R-b
7/9R-b R-b
8/9R-b R-b
9/9R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH net-next 0/9] inet_diag: remove three mutexes in diag dumps

Surprisingly, inet_diag operations are serialized over a stack of three mutexes, giving legacy /proc based files an unfair advantage on modern hosts.

This series removes all of them, making inet_diag operations (eg iproute2/ss) fully parallel.

1-2) Two first patches are adding data-race annotations
and can be backported to stable kernels.

3-4) inet_diag_table_mutex can be replaced with RCU protection,
if we add corresponding protection against module unload.

5-7) sock_diag_table_mutex can be replaced with RCU protection,
if we add corresponding protection against module unload.

8) sock_diag_mutex is removed, as the old bug it was working around has been fixed more elegantly.

9) inet_diag_dump_icsk() can skip over empty buckets to reduce spinlock contention.

Eric Dumazet (9):
sock_diag: annotate data-races around sock_diag_handlers[family]
inet_diag: annotate data-races around inet_diag_table[]
inet_diag: add module pointer to "struct inet_diag_handler"
inet_diag: allow concurrent operations
sock_diag: add module pointer to "struct sock_diag_handler"
sock_diag: allow concurrent operations
sock_diag: allow concurrent operation in sock_diag_rcv_msg()
sock_diag: remove sock_diag_mutex
inet_diag: skip over empty buckets

 include/linux/inet_diag.h |   1 +
 include/linux/sock_diag.h |  10 +++-
 net/core/sock_diag.c      | 120 +++++++++++++++++++++-----------------
 net/dccp/diag.c           |   1 +
 net/ipv4/inet_diag.c      | 101 ++++++++++++++++++--------------
 net/ipv4/raw_diag.c       |   1 +
 net/ipv4/tcp_diag.c       |   1 +
 net/ipv4/udp_diag.c       |   2 +
 net/mptcp/mptcp_diag.c    |   1 +
 net/netlink/diag.c        |   1 +
 net/packet/diag.c         |   1 +
 net/sctp/diag.c           |   1 +
 net/smc/smc_diag.c        |   1 +
 net/tipc/diag.c           |   1 +
 net/unix/diag.c           |   1 +
 net/vmw_vsock/diag.c      |   1 +
 net/xdp/xsk_diag.c        |   1 +
 17 files changed, 149 insertions(+), 97 deletions(-)
Signature · 1 line
2.43.0.429.g432eaa2c6b-goog