Re: [PATCH net-next v2 2/3] net: devmem: embed net_iov_area in binding
From: Stanislav Fomichev
Date: Mon Sep 14 2026 - 15:37:52 EST
On 09/11, Stanislav Fomichev wrote:
> After replacing the gen_pool with a binding-level freelist, devmem no
> longer needs a separate chunk owner object. There is only one
> net_iov_area for the binding, so store it directly in struct
> net_devmem_dmabuf_binding.
>
> Derive the binding from net_iov_owner() with container_of(), matching the
> pattern used by io_uring zcrx. This removes the leftover
> dmabuf_genpool_chunk_owner wrapper and its allocation/free path.
>
> Signed-off-by: Stanislav Fomichev <sdf@xxxxxxxxxxx>
> ---
> net/core/devmem.c | 41 ++++++++++-------------------------------
> net/core/devmem.h | 26 +++++++-------------------
> 2 files changed, 17 insertions(+), 50 deletions(-)
>
> diff --git a/net/core/devmem.c b/net/core/devmem.c
> index 4883eb7f3a95..7949f8425bcd 100644
> --- a/net/core/devmem.c
> +++ b/net/core/devmem.c
> @@ -29,15 +29,6 @@ static DEFINE_XARRAY_FLAGS(net_devmem_dmabuf_bindings, XA_FLAGS_ALLOC1);
>
> static const struct memory_provider_ops dmabuf_devmem_ops;
>
> -static void
> -net_devmem_dmabuf_free_chunk_owner(struct dmabuf_genpool_chunk_owner *owner)
> -{
> - if (owner) {
> - kvfree(owner->area.niovs);
> - kfree(owner);
> - }
> -}
> -
> static void net_devmem_dmabuf_binding_release(struct percpu_ref *ref)
> {
> struct net_devmem_dmabuf_binding *binding =
> @@ -55,7 +46,7 @@ void __net_devmem_dmabuf_binding_free(struct work_struct *wq)
> "can't destroy dmabuf binding. total=%zu, free=%zu",
> binding->total_niovs, binding->free_count);
>
> - net_devmem_dmabuf_free_chunk_owner(binding->chunk_owner);
> + kvfree(binding->area.niovs);
> dma_buf_unmap_attachment_unlocked(binding->attachment, binding->sgt,
> binding->direction);
> dma_buf_detach(binding->dmabuf, binding->attachment);
> @@ -271,23 +262,14 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,
> }
> binding->total_niovs = total_niovs;
>
> - owner = kzalloc_node(sizeof(*owner), GFP_KERNEL,
> - dev_to_node(&dev->dev));
There is a leftover owner var, the build fails, will repost later this week
(to give some time to review for whoever is interested).