Re: [PATCH net-next v2] net: convert netdev_nl_sock bindings list to xarray
From: Nikolay Aleksandrov
Date: Wed Aug 12 2026 - 10:30:43 EST
On 11/08/2026 17:29, Shivaji Kant wrote:
netdev_nl_sock previously used a struct list_head bindings to keep
track of active netdev netlink bindings, protected by a per-socket
struct mutex lock (priv->lock).
Since list modifications and iterations are not concurrency-safe,
priv->lock was introduced to serialize operations on priv->bindings.
However, xarray manages its own internal locking (xa_lock) for store,
erase, and iteration operations.
Convert bindings in struct netdev_nl_sock from struct list_head to
struct xarray and remove priv->lock. This simplifies the code by
removing explicit mutex locking in netdev_nl_bind_rx_doit(),
netdev_nl_bind_tx_doit(), and socket initialization/teardown functions.
Reviewed-by: Mina Almasry <almasrymina@xxxxxxxxxx>
Signed-off-by: Shivaji Kant <shivajikant@xxxxxxxxxx>
---
v1 -> v2:
- Add explicit err_erase_dmabuf_bindings err label in net_devmem_bind_dmabuf()
to align cleanup paths with the rest of the function (feedback from reviewer).
v1: https://lore.kernel.org/all/20260810065759.3735934-1-shivajikant@xxxxxxxxxx/
include/net/netdev_netlink.h | 5 ++---
net/core/devmem.c | 14 +++++++++++---
net/core/devmem.h | 4 ++--
net/core/netdev-genl.c | 25 ++++++-------------------
4 files changed, 21 insertions(+), 27 deletions(-)
Reviewed-by: Nikolay Aleksandrov <razor@xxxxxxxxxxxxx>