[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250509115126.63190-14-byungchul@sk.com>
Date: Fri, 9 May 2025 20:51:20 +0900
From: Byungchul Park <byungchul@...com>
To: willy@...radead.org,
netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
kernel_team@...ynix.com,
kuba@...nel.org,
almasrymina@...gle.com,
ilias.apalodimas@...aro.org,
harry.yoo@...cle.com,
hawk@...nel.org,
akpm@...ux-foundation.org,
ast@...nel.org,
daniel@...earbox.net,
davem@...emloft.net,
john.fastabend@...il.com,
andrew+netdev@...n.ch,
edumazet@...gle.com,
pabeni@...hat.com,
vishal.moola@...il.com
Subject: [RFC 13/19] page_pool: expand scope of is_pp_{netmem,page}() to global
Other than skbuff.c might need to check if a page or netmem is for page
pool, for example, page_alloc.c needs to check the page state, whether
it comes from page pool or not for their own purpose.
Expand the scope of is_pp_netmem() and introduce is_pp_page() newly, so
that those who want to check the source can achieve the checking without
accessing page pool member, page->pp_magic, directly.
Signed-off-by: Byungchul Park <byungchul@...com>
---
include/net/page_pool/types.h | 2 ++
net/core/page_pool.c | 10 ++++++++++
net/core/skbuff.c | 5 -----
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h
index 36eb57d73abc6..d3e1a52f01e09 100644
--- a/include/net/page_pool/types.h
+++ b/include/net/page_pool/types.h
@@ -299,4 +299,6 @@ static inline bool is_page_pool_compiled_in(void)
/* Caller must provide appropriate safe context, e.g. NAPI. */
void page_pool_update_nid(struct page_pool *pool, int new_nid);
+bool is_pp_netmem(netmem_ref netmem);
+bool is_pp_page(struct page *page);
#endif /* _NET_PAGE_POOL_H */
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index b61c1038f4c68..9c553e5a1b555 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -1225,3 +1225,13 @@ void net_mp_niov_clear_page_pool(struct netmem_desc *niov)
page_pool_clear_pp_info(netmem);
}
+
+bool is_pp_netmem(netmem_ref netmem)
+{
+ return (netmem_get_pp_magic(netmem) & ~0x3UL) == PP_SIGNATURE;
+}
+
+bool is_pp_page(struct page *page)
+{
+ return is_pp_netmem(page_to_netmem(page));
+}
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 6cbf77bc61fce..11098c204fe3e 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -893,11 +893,6 @@ static void skb_clone_fraglist(struct sk_buff *skb)
skb_get(list);
}
-static bool is_pp_netmem(netmem_ref netmem)
-{
- return (netmem_get_pp_magic(netmem) & ~0x3UL) == PP_SIGNATURE;
-}
-
int skb_pp_cow_data(struct page_pool *pool, struct sk_buff **pskb,
unsigned int headroom)
{
--
2.17.1
Powered by blists - more mailing lists