Re: [PATCH net-next v14 11/13] net: add SO_DEVMEM_DONTNEED setsockopt to release RX frags

From: Nikolay Aleksandrov
Date: Wed Jun 26 2024 - 07:14:59 EST


On 25/06/2024 22:53, Mina Almasry wrote:
Add an interface for the user to notify the kernel that it is done
reading the devmem dmabuf frags returned as cmsg. The kernel will
drop the reference on the frags to make them available for reuse.

Signed-off-by: Willem de Bruijn <willemb@xxxxxxxxxx>
Signed-off-by: Kaiyuan Zhang <kaiyuanz@xxxxxxxxxx>
Signed-off-by: Mina Almasry <almasrymina@xxxxxxxxxx>

---

v10:
- Fix leak of tokens (Nikolay).

v7:
- Updated SO_DEVMEM_* uapi to use the next available entry (Arnd).

v6:
- Squash in locking optimizations from edumazet@xxxxxxxxxx. With his
changes we lock the xarray once per sock_devmem_dontneed operation
rather than once per frag.

Changes in v1:
- devmemtoken -> dmabuf_token (David).
- Use napi_pp_put_page() for refcounting (Yunsheng).
- Fix build error with missing socket options on other asms.

---
arch/alpha/include/uapi/asm/socket.h | 1 +
arch/mips/include/uapi/asm/socket.h | 1 +
arch/parisc/include/uapi/asm/socket.h | 1 +
arch/sparc/include/uapi/asm/socket.h | 1 +
include/uapi/asm-generic/socket.h | 1 +
include/uapi/linux/uio.h | 4 ++
net/core/sock.c | 61 +++++++++++++++++++++++++++
7 files changed, 70 insertions(+)


FWIW,
Reviewed-by: Nikolay Aleksandrov <razor@xxxxxxxxxxxxx>