[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250509115126.63190-3-byungchul@sk.com>
Date: Fri, 9 May 2025 20:51:09 +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 02/19] netmem: introduce netmem alloc/put API to wrap page alloc/put API
To eliminate the use of struct page in page pool, the page pool code
should use netmem descriptor and API instead.
As part of the work, introduce netmem alloc/put API allowing the code to
use them rather than struct page things.
Signed-off-by: Byungchul Park <byungchul@...com>
---
include/net/netmem.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/include/net/netmem.h b/include/net/netmem.h
index 45c209d6cc689..c87a604e980b9 100644
--- a/include/net/netmem.h
+++ b/include/net/netmem.h
@@ -138,6 +138,24 @@ static inline netmem_ref page_to_netmem(struct page *page)
return (__force netmem_ref)page;
}
+static inline netmem_ref alloc_netmems_node(int nid, gfp_t gfp_mask,
+ unsigned int order)
+{
+ return page_to_netmem(alloc_pages_node(nid, gfp_mask, order));
+}
+
+static inline unsigned long alloc_netmems_bulk_node(gfp_t gfp, int nid,
+ unsigned long nr_netmems, netmem_ref *netmem_array)
+{
+ return alloc_pages_bulk_node(gfp, nid, nr_netmems,
+ (struct page **)netmem_array);
+}
+
+static inline void put_netmem(netmem_ref netmem)
+{
+ put_page(netmem_to_page(netmem));
+}
+
/**
* virt_to_netmem - convert virtual memory pointer to a netmem reference
* @data: host memory pointer to convert
--
2.17.1
Powered by blists - more mailing lists