[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250523032609.16334-19-byungchul@sk.com>
Date: Fri, 23 May 2025 12:26: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,
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: [PATCH 18/18] mm, netmem: remove the page pool members in struct page
Now that all the users of the page pool members in struct page have been
gone, the members can be removed from struct page.
However, since struct netmem_desc might still use the space in struct
page, the size of struct netmem_desc should be checked, until struct
netmem_desc has its own instance from slab, to avoid conficting with
other members within struct page.
Remove the page pool members in struct page and add a static checker for
the size.
Signed-off-by: Byungchul Park <byungchul@...com>
---
include/linux/mm_types.h | 11 -----------
include/net/netmem.h | 28 +++++-----------------------
2 files changed, 5 insertions(+), 34 deletions(-)
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 873e820e1521..5a7864eb9d76 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -119,17 +119,6 @@ struct page {
*/
unsigned long private;
};
- struct { /* page_pool used by netstack */
- unsigned long _pp_mapping_pad;
- /**
- * @pp_magic: magic value to avoid recycling non
- * page_pool allocated pages.
- */
- unsigned long pp_magic;
- struct page_pool *pp;
- unsigned long dma_addr;
- atomic_long_t pp_ref_count;
- };
struct { /* Tail pages of compound page */
unsigned long compound_head; /* Bit zero is set */
};
diff --git a/include/net/netmem.h b/include/net/netmem.h
index c63a7e20f5f3..257c22398d7a 100644
--- a/include/net/netmem.h
+++ b/include/net/netmem.h
@@ -77,30 +77,12 @@ struct net_iov_area {
unsigned long base_virtual;
};
-/* These fields in struct page are used by the page_pool and net stack:
- *
- * struct {
- * unsigned long _pp_mapping_pad;
- * unsigned long pp_magic;
- * struct page_pool *pp;
- * unsigned long dma_addr;
- * atomic_long_t pp_ref_count;
- * };
- *
- * We mirror the page_pool fields here so the page_pool can access these fields
- * without worrying whether the underlying fields belong to a page or net_iov.
- *
- * The non-net stack fields of struct page are private to the mm stack and must
- * never be mirrored to net_iov.
+/* XXX: The page pool fields in struct page have been removed but they
+ * might still use the space in struct page. Thus, the size of struct
+ * netmem_desc should be under control until struct netmem_desc has its
+ * own instance from slab.
*/
-#define NET_IOV_ASSERT_OFFSET(pg, iov) \
- static_assert(offsetof(struct page, pg) == \
- offsetof(struct net_iov, iov))
-NET_IOV_ASSERT_OFFSET(pp_magic, pp_magic);
-NET_IOV_ASSERT_OFFSET(pp, pp);
-NET_IOV_ASSERT_OFFSET(dma_addr, dma_addr);
-NET_IOV_ASSERT_OFFSET(pp_ref_count, pp_ref_count);
-#undef NET_IOV_ASSERT_OFFSET
+static_assert(sizeof(struct netmem_desc) <= offsetof(struct page, _refcount));
static inline struct net_iov_area *net_iov_owner(const struct net_iov *niov)
{
--
2.17.1
Powered by blists - more mailing lists