On 12/9/24 17:08, Mina Almasry wrote:
On Wed, Dec 4, 2024 at 9:22 AM David Wei <dw@xxxxxxxxxxx> wrote:
From: Pavel Begunkov <asml.silence@xxxxxxxxx>
Some page pool memory providers like io_uring need to catch the point
when the page pool is asked to be destroyed. ->destroy is not enough
because it relies on the page pool to wait for its buffers first, but
for that to happen a provider might need to react, e.g. to collect all
buffers that are currently given to the user space.
Add a new provider's scrub callback serving the purpose and called off
the pp's generic (cold) scrubbing path, i.e. page_pool_scrub().
Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
Signed-off-by: David Wei <dw@xxxxxxxxxxx>
I think after numerous previous discussions on this op, I guess I
finally see the point.
AFAIU on destruction tho io_uring instance will destroy the page_pool,
but we need to drop the user reference in the memory region. So the
io_uring instance will destroy the pool, then the scrub callback tells
io_uring that the pool is being destroyed, which drops the user
references.
I would have preferred if io_uring drops the user references before
destroying the pool, which I think would have accomplished the same
thing without adding a memory provider callback that is a bit specific
to this use case, but I guess it's all the same.
For unrelated reasons I moved it to a later stage to io_uring code,
so pool->mp_ops->scrub is no more. v8 is just weird, I think David
sent an old branch because Jakub asked or so.
Reviewed-by: Mina Almasry <almasrymina@xxxxxxxxxx>
--
Pavel Begunkov