Re: [PATCH net-next v6 3/5] page_pool: Allow drivers to hint on SKB recycling

From: Matteo Croce
Date: Thu Jun 03 2021 - 14:46:01 EST


On Fri, May 21, 2021 at 6:16 PM Matteo Croce <mcroce@xxxxxxxxxxxxxxxxxxx> wrote:
> +bool page_pool_return_skb_page(void *data)
> +{
> + struct page_pool *pp;
> + struct page *page;
> +
> + page = virt_to_head_page(data);
> + if (unlikely(page->pp_magic != PP_SIGNATURE))
> + return false;
> +
> + pp = (struct page_pool *)page->pp;
> +
> + /* Driver set this to memory recycling info. Reset it on recycle.
> + * This will *not* work for NIC using a split-page memory model.
> + * The page will be returned to the pool here regardless of the
> + * 'flipped' fragment being in use or not.
> + */
> + page->pp = NULL;
> + page_pool_put_full_page(pp, virt_to_head_page(data), false);

Here I could just use the cached "page" instead of calling
virt_to_head_page() once again.

--
per aspera ad upstream