Thread (16 messages) 16 messages, 5 authors, 2021-06-07

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

From: Matteo Croce <hidden>
Date: 2021-06-03 18:45:59
Also in: bpf, linux-mm, linux-rdma, lkml

On Fri, May 21, 2021 at 6:16 PM Matteo Croce [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help