OSDN Git Service

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)
commitc3f812cea0d7006469d1cf33a4a9f0a12bb4b3a3
tree7c0bb8f75587b1c9d219c0006c44c73432931eeb
parent3af7ff93e43bcab458bd223180b73970b446a8b8
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: d956a048cd3f ("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