[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250529031047.7587-17-byungchul@sk.com>
Date: Thu, 29 May 2025 12:10:45 +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,
davem@...emloft.net,
john.fastabend@...il.com,
andrew+netdev@...n.ch,
asml.silence@...il.com,
toke@...hat.com,
tariqt@...dia.com,
edumazet@...gle.com,
pabeni@...hat.com,
saeedm@...dia.com,
leon@...nel.org,
ast@...nel.org,
daniel@...earbox.net,
david@...hat.com,
lorenzo.stoakes@...cle.com,
Liam.Howlett@...cle.com,
vbabka@...e.cz,
rppt@...nel.org,
surenb@...gle.com,
mhocko@...e.com,
horms@...nel.org,
linux-rdma@...r.kernel.org,
bpf@...r.kernel.org,
vishal.moola@...il.com
Subject: [RFC v3 16/18] netmem: introduce a netmem API, virt_to_head_netmem()
To eliminate the use of struct page in page pool, the page pool code
should use netmem descriptor and APIs instead.
As part of the work, introduce a netmem API to convert a virtual address
to a head netmem allowing the code to use it rather than the existing
API, virt_to_head_page() for struct page.
Signed-off-by: Byungchul Park <byungchul@...com>
---
include/net/netmem.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/net/netmem.h b/include/net/netmem.h
index ef639b5c70ec..f05a8b008d00 100644
--- a/include/net/netmem.h
+++ b/include/net/netmem.h
@@ -270,6 +270,13 @@ static inline netmem_ref netmem_compound_head(netmem_ref netmem)
return page_to_netmem(compound_head(netmem_to_page(netmem)));
}
+static inline netmem_ref virt_to_head_netmem(const void *x)
+{
+ netmem_ref netmem = virt_to_netmem(x);
+
+ return netmem_compound_head(netmem);
+}
+
/**
* __netmem_address - unsafely get pointer to the memory backing @netmem
* @netmem: netmem reference to get the pointer for
--
2.17.1
Powered by blists - more mailing lists