]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Dec 2019 15:05:58 +0000 (16:05 +0100)
commitbf22306d92ca59c59dc4aa3bab14768948193d56
tree7d133c4de2629eaf7d56445c41d25f111ca70dd2
parent573da3cf4ec5427bdd4acc23a282de346c77d4bc
page_pool: do not release pool until inflight == 0.

[ Upstream commit c3f812cea0d7006469d1cf33a4a9f0a12bb4b3a3 ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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