]> git.baikalelectronics.ru Git - kernel.git/commit
page_pool: do not release pool until inflight == 0.
authorJonathan Lemon <jonathan.lemon@gmail.com>
Thu, 14 Nov 2019 22:13:00 +0000 (14:13 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 16 Nov 2019 20:39:10 +0000 (12:39 -0800)
commitb69d004270f4e4e9070e86ac1426afbd49215287
tree7c0bb8f75587b1c9d219c0006c44c73432931eeb
parent255d1113d5dfcc56229c7b0939b923047bd5da73
page_pool: do not release pool until inflight == 0.

The page pool keeps track of the number of pages in flight, and
it isn't safe to remove the pool until all pages are returned.

Disallow removing the pool until all pages are back, so the pool
is always available for page producers.

Make the page pool responsible for its own delayed destruction
instead of relying on XDP, so the page pool can be used without
the xdp memory model.

When all pages are returned, free the pool and notify xdp if the
pool is registered with the xdp memory system.  Have the callback
perform a table walk since some drivers (cpsw) may share the pool
among multiple xdp_rxq_info.

Note that the increment of pages_state_release_cnt may result in
inflight == 0, resulting in the pool being released.

Fixes: 8d5a5861953b ("xdp: force mem allocator removal and periodic warning")
Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
include/net/page_pool.h
include/net/xdp_priv.h
include/trace/events/xdp.h
net/core/page_pool.c
net/core/xdp.c