Re: [PATCH net-next v3 1/3] net: devmem: replace gen_pool with freelist

From: Mina Almasry

Date: Mon Sep 21 2026 - 19:36:12 EST


On Thu, Sep 17, 2026 at 11:11 AM Stanislav Fomichev
<sdf.kernel@xxxxxxxxx> wrote:
>
> devmem only needs fixed-size net_iov allocations for each dma-buf binding.
> The gen_pool tracks the same free set indirectly through DMA addresses,
> which makes devmem depend on the generic allocator even though the users
> are fixed-size net_iov chunks.
>
> Mirror the io_uring zcrx model more closely by keeping a binding-level
> freelist protected by spin_lock_bh(). Use a single net_iov_area owner for
> the binding, populate each net_iov's DMA address while walking the SG
> table, and check at teardown that all net_iovs have returned to the
> freelist.
>
> Validate the DMA-BUF size against the net_iov size up front and derive the
> RX and TX entry count from it, avoiding a separate SG-table pass.
>
> Drop the NET_DEVMEM select of GENERIC_ALLOCATOR now that devmem no longer
> calls gen_pool APIs.
>
> Signed-off-by: Stanislav Fomichev <sdf@xxxxxxxxxxx>

Reviewed-by: Mina Almasry <almasrymina@xxxxxxxxxx>