Skip to content

Commit 8cfa2de

Browse files
LiangChen77davem330
authored andcommitted
skbuff: Add a function to check if a page belongs to page_pool
Wrap code for checking if a page is a page_pool page into a function for better readability and ease of reuse. Signed-off-by: Liang Chen <[email protected]> Reviewed-by: Yunsheng Lin <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Reviewed-by: Mina Almasry <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent aaf153a commit 8cfa2de

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

net/core/skbuff.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,11 @@ static void skb_clone_fraglist(struct sk_buff *skb)
890890
skb_get(list);
891891
}
892892

893+
static bool is_pp_page(struct page *page)
894+
{
895+
return (page->pp_magic & ~0x3UL) == PP_SIGNATURE;
896+
}
897+
893898
#if IS_ENABLED(CONFIG_PAGE_POOL)
894899
bool napi_pp_put_page(struct page *page, bool napi_safe)
895900
{
@@ -905,7 +910,7 @@ bool napi_pp_put_page(struct page *page, bool napi_safe)
905910
* and page_is_pfmemalloc() is checked in __page_pool_put_page()
906911
* to avoid recycling the pfmemalloc page.
907912
*/
908-
if (unlikely((page->pp_magic & ~0x3UL) != PP_SIGNATURE))
913+
if (unlikely(!is_pp_page(page)))
909914
return false;
910915

911916
pp = page->pp;

0 commit comments

Comments
 (0)