On 1/6/25 22:46, Mina Almasry wrote:
On Tue, Dec 17, 2024 at 4:38 PM David Wei <dw@xxxxxxxxxxx> wrote:
Add io_zcrx_area that represents a region of userspace memory that is
used for zero copy. During ifq registration, userspace passes in the
uaddr and len of userspace memory, which is then pinned by the kernel.
Each net_iov is mapped to one of these pages.
The freelist is a spinlock protected list that keeps track of all the
net_iovs/pages that aren't used.
FWIW we devmem uses genpool to manage the freelist and that lets us do
allocations/free without locks. Not saying you should migrate to that
but it's an option you have available.
It's not the hot path to care that much, but even then lockfree
is not always faster. It's naturally batched for allocations
while genpool does enough of work including at least a couple
of atomics.
--
Pavel Begunkov