From nobody Wed Dec 17 00:04:42 2025 Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA91931B819; Mon, 15 Dec 2025 07:10:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.125.252.92 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765782646; cv=none; b=Y/myNxoBleVrFPFA6UmJwO85sgjfGwezdIOqLe36ki/ER45RTw11H7YEjvQBCE0EcpLubuyjnDe5QCqjjjEEMSXADfB6KA19YiucVJsG/0lagO+9b/UOf8X1fzRCnjtpItTmCuibx/Wzhht6oTo+Cn8k61Z3z16+cq4ZOfc2LaQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765782646; c=relaxed/simple; bh=sSKeR5qbAmosX44UJSW1gJ9GYSlyPAnvpz0/jMFWhVU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=epDQXgzn36T0H+MexPKt7f4W6+SjcYfpoIDDHADvvjRL1a/NmPDD8cFTzBCGK8r3VSR38kbl0WT5JKhuEg8EmEyYJr10zPWTdoL8s1IKorQg4YoCwXjU1u3SJeoGiV+fNKroG7HKqwOj+KzKIaqs2Q+x9uHGmO8tfmOSG8S+GS0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com; spf=pass smtp.mailfrom=sk.com; arc=none smtp.client-ip=166.125.252.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sk.com X-AuditID: a67dfc5b-c2dff70000001609-53-693fb4702647 From: Byungchul Park To: linux-mm@kvack.org, akpm@linux-foundation.org, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel_team@skhynix.com, harry.yoo@oracle.com, ast@kernel.org, daniel@iogearbox.net, davem@davemloft.net, kuba@kernel.org, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, saeedm@nvidia.com, leon@kernel.org, tariqt@nvidia.com, mbloch@nvidia.com, andrew+netdev@lunn.ch, edumazet@google.com, pabeni@redhat.com, david@redhat.com, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, mhocko@suse.com, horms@kernel.org, jackmanb@google.com, hannes@cmpxchg.org, ziy@nvidia.com, ilias.apalodimas@linaro.org, willy@infradead.org, brauner@kernel.org, kas@kernel.org, yuzhao@google.com, usamaarif642@gmail.com, baolin.wang@linux.alibaba.com, almasrymina@google.com, toke@redhat.com, asml.silence@gmail.com, bpf@vger.kernel.org, linux-rdma@vger.kernel.org, sfr@canb.auug.org.au, dw@davidwei.uk, ap420073@gmail.com, dtatulea@nvidia.com Subject: [PATCH 1/2] mm: introduce a new page type for page pool in page type Date: Mon, 15 Dec 2025 16:10:00 +0900 Message-Id: <20251215071001.78263-2-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20251215071001.78263-1-byungchul@sk.com> References: <20251215071001.78263-1-byungchul@sk.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Brightmail-Tracker: H4sIAAAAAAAAA02Sa1BMYRzGvfuePee0WnMs6uAD1hgzLlFT+bsMDYPzgRmN4QNjakdntNTW 7HafYYqIRiGXrS3JRHfWrGy7TZHKJmWsUnNcuogk1kpYUiZnawzfnnme9/d7v/xprGiWzqHV mhheq1FFKEkZIfvkeXV5dOUG9Urz0FLIM1aQUP4zAYp7LVIYqRiQQF6ZGcG3kZcUjNfaEHxt bCLhY8MwgsKrLgx5T1IJ+G78hcFaPYDgQ/YNEvptfRSUm7ZDT9E7AmrSqjD0nXlIQkbqKIba EScFRy0lov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yagMbUOgzDp7tIyDRNY2hy j1FwwnFdAlclUeAs6pbDg9osOZz7cRVDXdILCh41WEgYLJ+Rw+u2TAK6zSUEfMptxzCUFQYu qy9M3fmAoN1WJ4OpU0Uk9BU0yKCmqY+Cs71WEkZMQwh6ncME5P5MI6EwOQvB9HcJOZY9KYfC jkEqbDWXLIok5/wwjrnqkqcy7kl+DsGJt27LuHrzAMVZ7fFc1fUALkPsxZy9NJ3k7F/OUFz/ k0aS68qfJrj6l8FcvWNCxmWmjJE7fCMUG6L4GMHI61eHRiq0o29tsri7OxP6XBU4CbnCM5AX zTLr2MYrlcijSWYFK4pu7NE+zDa2svax5CtozIxRbGPzN9ITeEtB6vmThEcTzDLWUdIiz0A0 rWTWs8U9Xn+YS9iyGy2zHC8miL08kDfLV0mVM2/Pz2olM5/tLnhFeKZYumu7oPLYWJqm1BTi bKQ0/9cy/2uZ/2tZES5FPkKsUacRYtavMkRrE2OFhFX7DunsSPqh4uM/cxxo8tHmNsTQSD1P Kd4MFVRyjdGQqGtDLI3VPso0UbKUUZrEI7z+0F59fAxvaEOLaELtp9yyi49UMQc0h/lono/j 9X9TGe3ln4SSX3q38xGf50xQHell6We1iwbs+mNPjT3wyVJlDInssF46ujWsIHRB3W6he2BT UNbC3R+NS385iwqe3escz+73HUoI8g3X6nsuNKVO1sbPWJZrdaagHJ+IDMV81n+/GCw8iH74 fG7KXj7v4NqNFYE7O5rdupY9z6rMi1s/V7aeWKEmDFpNYADWGzS/ARsnlsU/AwAA X-CFilter-Loop: Reflected Currently, the condition 'page->pp_magic =3D=3D PP_SIGNATURE' is used to determine if a page belongs to a page pool. However, with the planned removal of @pp_magic, we should instead leverage the page_type in struct page, such as PGTY_netpp, for this purpose. Introduce and use the page type APIs e.g. PageNetpp(), __SetPageNetpp(), and __ClearPageNetpp() instead, and remove the existing APIs accessing @pp_magic e.g. page_pool_page_is_pp(), netmem_or_pp_magic(), and netmem_clear_pp_magic(). Plus, add @page_type to struct net_iov at the same offset as struct page so as to use the page_type APIs for struct net_iov as well. While at it, reorder @type and @owner in struct net_iov to avoid a hole and increasing the struct size. This work was inspired by the following link: https://lore.kernel.org/all/582f41c0-2742-4400-9c81-0d46bf4e8314@gmail.co= m/ While at it, move the sanity check for page pool to on the free path. Suggested-by: David Hildenbrand Co-developed-by: Pavel Begunkov Signed-off-by: Pavel Begunkov Signed-off-by: Byungchul Park Acked-by: David Hildenbrand Acked-by: Zi Yan Reviewed-by: Toke H=C3=B8iland-J=C3=B8rgensen --- .../net/ethernet/mellanox/mlx5/core/en/xdp.c | 2 +- include/linux/mm.h | 27 +++---------------- include/linux/page-flags.h | 6 +++++ include/net/netmem.h | 15 +++++++++-- mm/page_alloc.c | 11 +++++--- net/core/netmem_priv.h | 20 +++++--------- net/core/page_pool.c | 18 +++++++++++-- 7 files changed, 53 insertions(+), 46 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c b/drivers/net= /ethernet/mellanox/mlx5/core/en/xdp.c index 80f9fc10877ad..7d90d2485c787 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c @@ -707,7 +707,7 @@ static void mlx5e_free_xdpsq_desc(struct mlx5e_xdpsq *s= q, xdpi =3D mlx5e_xdpi_fifo_pop(xdpi_fifo); page =3D xdpi.page.page; =20 - /* No need to check page_pool_page_is_pp() as we + /* No need to check PageNetpp() as we * know this is a page_pool page. */ page_pool_recycle_direct(pp_page_to_nmdesc(page)->pp, diff --git a/include/linux/mm.h b/include/linux/mm.h index 15076261d0c2e..94f824bf0d38c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -4565,10 +4565,9 @@ int arch_lock_shadow_stack_status(struct task_struct= *t, unsigned long status); * DMA mapping IDs for page_pool * * When DMA-mapping a page, page_pool allocates an ID (from an xarray) and - * stashes it in the upper bits of page->pp_magic. We always want to be ab= le to - * unambiguously identify page pool pages (using page_pool_page_is_pp()). = Non-PP - * pages can have arbitrary kernel pointers stored in the same field as pp= _magic - * (since it overlaps with page->lru.next), so we must ensure that we cann= ot + * stashes it in the upper bits of page->pp_magic. Non-PP pages can have + * arbitrary kernel pointers stored in the same field as pp_magic (since + * it overlaps with page->lru.next), so we must ensure that we cannot * mistake a valid kernel pointer with any of the values we write into this * field. * @@ -4603,26 +4602,6 @@ int arch_lock_shadow_stack_status(struct task_struct= *t, unsigned long status); #define PP_DMA_INDEX_MASK GENMASK(PP_DMA_INDEX_BITS + PP_DMA_INDEX_SHIFT -= 1, \ PP_DMA_INDEX_SHIFT) =20 -/* Mask used for checking in page_pool_page_is_pp() below. page->pp_magic = is - * OR'ed with PP_SIGNATURE after the allocation in order to preserve bit 0= for - * the head page of compound page and bit 1 for pfmemalloc page, as well a= s the - * bits used for the DMA index. page_is_pfmemalloc() is checked in - * __page_pool_put_page() to avoid recycling the pfmemalloc page. - */ -#define PP_MAGIC_MASK ~(PP_DMA_INDEX_MASK | 0x3UL) - -#ifdef CONFIG_PAGE_POOL -static inline bool page_pool_page_is_pp(const struct page *page) -{ - return (page->pp_magic & PP_MAGIC_MASK) =3D=3D PP_SIGNATURE; -} -#else -static inline bool page_pool_page_is_pp(const struct page *page) -{ - return false; -} -#endif - #define PAGE_SNAPSHOT_FAITHFUL (1 << 0) #define PAGE_SNAPSHOT_PG_BUDDY (1 << 1) #define PAGE_SNAPSHOT_PG_IDLE (1 << 2) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index f7a0e4af0c734..39a21ee87b437 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -934,6 +934,7 @@ enum pagetype { PGTY_zsmalloc =3D 0xf6, PGTY_unaccepted =3D 0xf7, PGTY_large_kmalloc =3D 0xf8, + PGTY_netpp =3D 0xf9, =20 PGTY_mapcount_underflow =3D 0xff }; @@ -1066,6 +1067,11 @@ PAGE_TYPE_OPS(Zsmalloc, zsmalloc, zsmalloc) PAGE_TYPE_OPS(Unaccepted, unaccepted, unaccepted) PAGE_TYPE_OPS(LargeKmalloc, large_kmalloc, large_kmalloc) =20 +/* + * Marks page_pool allocated pages. + */ +PAGE_TYPE_OPS(Netpp, netpp, netpp) + /** * PageHuge - Determine if the page belongs to hugetlbfs * @page: The page to test. diff --git a/include/net/netmem.h b/include/net/netmem.h index 9e10f4ac50c3d..2a73b68f16b15 100644 --- a/include/net/netmem.h +++ b/include/net/netmem.h @@ -110,10 +110,21 @@ struct net_iov { atomic_long_t pp_ref_count; }; }; - struct net_iov_area *owner; + + unsigned int page_type; enum net_iov_type type; + struct net_iov_area *owner; }; =20 +/* Make sure 'the offset of page_type in struct page =3D=3D the offset of + * type in struct net_iov'. + */ +#define NET_IOV_ASSERT_OFFSET(pg, iov) \ + static_assert(offsetof(struct page, pg) =3D=3D \ + offsetof(struct net_iov, iov)) +NET_IOV_ASSERT_OFFSET(page_type, page_type); +#undef NET_IOV_ASSERT_OFFSET + struct net_iov_area { /* Array of net_iovs for this area. */ struct net_iov *niovs; @@ -256,7 +267,7 @@ static inline unsigned long netmem_pfn_trace(netmem_ref= netmem) */ #define pp_page_to_nmdesc(p) \ ({ \ - DEBUG_NET_WARN_ON_ONCE(!page_pool_page_is_pp(p)); \ + DEBUG_NET_WARN_ON_ONCE(!PageNetpp(p)); \ __pp_page_to_nmdesc(p); \ }) =20 diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 5bb3a7844abb6..c126a9790953b 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1042,7 +1042,6 @@ static inline bool page_expected_state(struct page *p= age, #ifdef CONFIG_MEMCG page->memcg_data | #endif - page_pool_page_is_pp(page) | (page->flags.f & check_flags))) return false; =20 @@ -1069,8 +1068,6 @@ static const char *page_bad_reason(struct page *page,= unsigned long flags) if (unlikely(page->memcg_data)) bad_reason =3D "page still charged to cgroup"; #endif - if (unlikely(page_pool_page_is_pp(page))) - bad_reason =3D "page_pool leak"; return bad_reason; } =20 @@ -1379,9 +1376,15 @@ __always_inline bool free_pages_prepare(struct page = *page, mod_mthp_stat(order, MTHP_STAT_NR_ANON, -1); folio->mapping =3D NULL; } - if (unlikely(page_has_type(page))) + if (unlikely(page_has_type(page))) { + /* networking expects to clear its page type before releasing */ + if (unlikely(PageNetpp(page))) { + bad_page(page, "page_pool leak"); + return false; + } /* Reset the page_type (which overlays _mapcount) */ page->page_type =3D UINT_MAX; + } =20 if (is_check_pages_enabled()) { if (free_page_is_bad(page)) diff --git a/net/core/netmem_priv.h b/net/core/netmem_priv.h index 23175cb2bd866..6b7d90b8ebb9b 100644 --- a/net/core/netmem_priv.h +++ b/net/core/netmem_priv.h @@ -8,21 +8,15 @@ static inline unsigned long netmem_get_pp_magic(netmem_re= f netmem) return netmem_to_nmdesc(netmem)->pp_magic & ~PP_DMA_INDEX_MASK; } =20 -static inline void netmem_or_pp_magic(netmem_ref netmem, unsigned long pp_= magic) -{ - netmem_to_nmdesc(netmem)->pp_magic |=3D pp_magic; -} - -static inline void netmem_clear_pp_magic(netmem_ref netmem) -{ - WARN_ON_ONCE(netmem_to_nmdesc(netmem)->pp_magic & PP_DMA_INDEX_MASK); - - netmem_to_nmdesc(netmem)->pp_magic =3D 0; -} - static inline bool netmem_is_pp(netmem_ref netmem) { - return (netmem_get_pp_magic(netmem) & PP_MAGIC_MASK) =3D=3D PP_SIGNATURE; + /* XXX: Now that the offset of page_type is shared between + * struct page and net_iov, just cast the netmem to struct page + * unconditionally by clearing NET_IOV if any, no matter whether + * it comes from struct net_iov or struct page. This should be + * adjusted once the offset is no longer shared. + */ + return PageNetpp(__netmem_to_page((__force unsigned long)netmem & ~NET_IO= V)); } =20 static inline void netmem_set_pp(netmem_ref netmem, struct page_pool *pool) diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 265a729431bb7..323314b1333ee 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -703,7 +703,14 @@ s32 page_pool_inflight(const struct page_pool *pool, b= ool strict) void page_pool_set_pp_info(struct page_pool *pool, netmem_ref netmem) { netmem_set_pp(netmem, pool); - netmem_or_pp_magic(netmem, PP_SIGNATURE); + + /* XXX: Now that the offset of page_type is shared between + * struct page and net_iov, just cast the netmem to struct page + * unconditionally by clearing NET_IOV if any, no matter whether + * it comes from struct net_iov or struct page. This should be + * adjusted once the offset is no longer shared. + */ + __SetPageNetpp(__netmem_to_page((__force unsigned long)netmem & ~NET_IOV)= ); =20 /* Ensuring all pages have been split into one fragment initially: * page_pool_set_pp_info() is only called once for every page when it @@ -718,7 +725,14 @@ void page_pool_set_pp_info(struct page_pool *pool, net= mem_ref netmem) =20 void page_pool_clear_pp_info(netmem_ref netmem) { - netmem_clear_pp_magic(netmem); + /* XXX: Now that the offset of page_type is shared between + * struct page and net_iov, just cast the netmem to struct page + * unconditionally by clearing NET_IOV if any, no matter whether + * it comes from struct net_iov or struct page. This should be + * adjusted once the offset is no longer shared. + */ + __ClearPageNetpp(__netmem_to_page((__force unsigned long)netmem & ~NET_IO= V)); + netmem_set_pp(netmem, NULL); } =20 --=20 2.17.1 From nobody Wed Dec 17 00:04:42 2025 Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA87831B13B; Mon, 15 Dec 2025 07:10:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.125.252.92 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765782646; cv=none; b=Ta1KzXvUP5hzf5rl0ZKmz8FO72bxJfLfE2mkY7rhIAzgo5jD3eU42EQLfeYOG8RYvOfESjFfRc0eeoluo4BSC113ddKClxL9J5NfYIND6qcNpQpGMrSGD72zaSfgHDuGA8EFS3RMyx5vk110XrxIVV81VNscSROCz+e/b2x9RHk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765782646; c=relaxed/simple; bh=AJTQpL0AwT5x6g1BXMDRpmEijhUtcV95YYb8dBDDX5g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=G97EMDN50YkQl8k5mIyhHiRuQVy9cqsiZON3Hx3ZRGcHh5LyldugQ9R1e7m5cQQ2GtDFCXYxKLmywDrnZfSEA9Gll9dGNBB9M8ha16FKRvhdzOkHd/ej5TAkZz4ZCeh8yfqjoBfUJoPB3tolW11+dNpIeWQczKB4C1vo7u7jh8I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com; spf=pass smtp.mailfrom=sk.com; arc=none smtp.client-ip=166.125.252.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sk.com X-AuditID: a67dfc5b-c45ff70000001609-60-693fb470c4fe From: Byungchul Park To: linux-mm@kvack.org, akpm@linux-foundation.org, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel_team@skhynix.com, harry.yoo@oracle.com, ast@kernel.org, daniel@iogearbox.net, davem@davemloft.net, kuba@kernel.org, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, saeedm@nvidia.com, leon@kernel.org, tariqt@nvidia.com, mbloch@nvidia.com, andrew+netdev@lunn.ch, edumazet@google.com, pabeni@redhat.com, david@redhat.com, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, mhocko@suse.com, horms@kernel.org, jackmanb@google.com, hannes@cmpxchg.org, ziy@nvidia.com, ilias.apalodimas@linaro.org, willy@infradead.org, brauner@kernel.org, kas@kernel.org, yuzhao@google.com, usamaarif642@gmail.com, baolin.wang@linux.alibaba.com, almasrymina@google.com, toke@redhat.com, asml.silence@gmail.com, bpf@vger.kernel.org, linux-rdma@vger.kernel.org, sfr@canb.auug.org.au, dw@davidwei.uk, ap420073@gmail.com, dtatulea@nvidia.com Subject: [PATCH 2/2] mm, netmem: remove the page pool members in struct page Date: Mon, 15 Dec 2025 16:10:01 +0900 Message-Id: <20251215071001.78263-3-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20251215071001.78263-1-byungchul@sk.com> References: <20251215071001.78263-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSf0yMcRzHfZ/nued5Om6enfBgw25oGuXHsY/NzyFfVluGf8rG0TP30K/d VUpjl7J+cEmJXLVdKP0iu9IvpVypw0YLOcOVKzWkiNKVX9fRf6993u/3668PS8oTJHNZMTRC 0ISqghW0lJJ+nnZ1eXjFJnFF131vyCkrpaFkNBpudFVLwFHaR0BOcSWC747XDPypb0HwrbmV hk9NQwiu5Y2QkPM0gYLhsjESamr7EHzMuknD+xY7AyUmP+gs6KWgLrGKBPt5Cw36hHES6h0D DJyuLnSKy3UMtFWmSuDiWD4JVbouBp7V5tBgK/0jgV6znoKHhiIKvmQ2k9CZuhlajLNg5HE/ guayKgJGzuXS8OJKLQF36l8wkNFupKE7oRNBe5OdgsyfSTRkx6UiGB91KgfSvksg+4GN2eyF 46xWGjf1D5K4ougVgTuyLlDYeu8RgWsMbxlsNEXi8kJPnGJtJ7GpOJnGpqF0Br/pqKOxJWuc wjXv1uGa6m8E1scP0P4zA6Trg4RgMUrQeG88KFXrLYHhX6dHX09uJXQoRZaC3FieU/J6SyYx ybavPeQE05wHb7U6XOzO+fG3Kp+jFCRlSW6A4esaftATwQzOly9yDLtKFLeYv9OZ5hLJuDV8 S+PZ/9IFfMntRlfHjVvLX3t7CU2w3NlJ/3DZJeW5RpZ//HQQ/RvM4e8XWqk0JDOiKcVILoZG hajEYKWXOiZUjPY6HBZiQs7fKDj5M7AaDbXtMSOORYppsraKjaJcoorSxoSYEc+SCndZktV5 kgWpYk4ImrADmshgQWtG81hKMVu2auR4kJw7oooQjglCuKCZTAnWba4OndyxfOHqjNK4L6JH Ul7Yr9it5T6DG3arGUProe2taE6vJTkAHg2bdvmX7Kyw4Z7IGe2ORI/i37xO5Mz2qUuM3Q+K EjdpZFqDURH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tosF2cf/y2CxMNnRcLulevWKh9dTYn3jDAzzhZ78cnthZPSiVO6K/onSVGUQU5plIo13qRa o/gLKI2TbfkCAAA= X-CFilter-Loop: Reflected Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 both struct netmem_desc and struct page still share the same space, the important offsets should be checked properly, until struct netmem_desc has its own instance from slab. Remove the page pool members in struct page and adjust static checkers for the offsets. Signed-off-by: Byungchul Park --- include/linux/mm_types.h | 11 ----------- include/net/netmem.h | 7 ++----- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 9f6de068295d3..46d3c4b52cc10 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -114,17 +114,6 @@ struct page { */ unsigned long private; }; - struct { /* page_pool used by netstack */ - /** - * @pp_magic: magic value to avoid recycling non - * page_pool allocated pages. - */ - unsigned long pp_magic; - struct page_pool *pp; - unsigned long _pp_mapping_pad; - 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 2a73b68f16b15..01d689de11511 100644 --- a/include/net/netmem.h +++ b/include/net/netmem.h @@ -42,11 +42,8 @@ struct netmem_desc { static_assert(offsetof(struct page, pg) =3D=3D \ offsetof(struct netmem_desc, desc)) NETMEM_DESC_ASSERT_OFFSET(flags, _flags); -NETMEM_DESC_ASSERT_OFFSET(pp_magic, pp_magic); -NETMEM_DESC_ASSERT_OFFSET(pp, pp); -NETMEM_DESC_ASSERT_OFFSET(_pp_mapping_pad, _pp_mapping_pad); -NETMEM_DESC_ASSERT_OFFSET(dma_addr, dma_addr); -NETMEM_DESC_ASSERT_OFFSET(pp_ref_count, pp_ref_count); +NETMEM_DESC_ASSERT_OFFSET(lru, pp_magic); +NETMEM_DESC_ASSERT_OFFSET(mapping, _pp_mapping_pad); #undef NETMEM_DESC_ASSERT_OFFSET =20 /* --=20 2.17.1