linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH net-next] netmem: remove the pp fields from net_iov
@ 2026-02-24  6:14 Byungchul Park
  2026-02-25  9:14 ` Simon Horman
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Byungchul Park @ 2026-02-24  6:14 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, linux-mm, kernel_team, harry.yoo, hawk,
	andrew+netdev, david, lorenzo.stoakes, Liam.Howlett, vbabka, ziy,
	willy, toke, davem, edumazet, kuba, pabeni, horms, asml.silence,
	axboe, ncardwell, kuniyu, dsahern, almasrymina, sdf, dw,
	ap420073, dtatulea, shivajikant, io-uring

Now that the pp fields in net_iov have no users, remove them from
net_iov and clean up.

Signed-off-by: Byungchul Park <byungchul@sk.com>
---
The original post was:

  https://lore.kernel.org/all/20251121040047.71921-1-byungchul@sk.com/

1/3 was covered by Pavel's patch:

  commit f0243d2b86b97 ("io_uring/zcrx: convert to use netmem_desc").

2/3 was taken by Jakub and merged:

  commit df59bb5b9af3f ("netmem, devmem, tcp: access pp fields through
  @desc in net_iov")

Now that io-uring and net core changes converge in one tree, I'm
resending the 3/3, which is what Jakub asked:

  https://lore.kernel.org/all/20251124184729.7e365941@kernel.org/
---
 include/net/netmem.h | 38 +-------------------------------------
 1 file changed, 1 insertion(+), 37 deletions(-)

diff --git a/include/net/netmem.h b/include/net/netmem.h
index a96b3e5e5574..a6d65ced5231 100644
--- a/include/net/netmem.h
+++ b/include/net/netmem.h
@@ -93,23 +93,7 @@ enum net_iov_type {
  *		supported.
  */
 struct net_iov {
-	union {
-		struct netmem_desc desc;
-
-		/* XXX: The following part should be removed once all
-		 * the references to them are converted so as to be
-		 * accessed via netmem_desc e.g. niov->desc.pp instead
-		 * of niov->pp.
-		 */
-		struct {
-			unsigned long _flags;
-			unsigned long pp_magic;
-			struct page_pool *pp;
-			unsigned long _pp_mapping_pad;
-			unsigned long dma_addr;
-			atomic_long_t pp_ref_count;
-		};
-	};
+	struct netmem_desc desc;
 	struct net_iov_area *owner;
 	enum net_iov_type type;
 };
@@ -123,26 +107,6 @@ struct net_iov_area {
 	unsigned long base_virtual;
 };
 
-/* net_iov is union'ed with struct netmem_desc mirroring struct page, so
- * the page_pool can access these fields without worrying whether the
- * underlying fields are accessed via netmem_desc or directly via
- * net_iov, until all the references to them are converted so as to be
- * accessed via netmem_desc e.g. niov->desc.pp instead of niov->pp.
- *
- * The non-net stack fields of struct page are private to the mm stack
- * and must never be mirrored to net_iov.
- */
-#define NET_IOV_ASSERT_OFFSET(desc, iov)                    \
-	static_assert(offsetof(struct netmem_desc, desc) == \
-		      offsetof(struct net_iov, iov))
-NET_IOV_ASSERT_OFFSET(_flags, _flags);
-NET_IOV_ASSERT_OFFSET(pp_magic, pp_magic);
-NET_IOV_ASSERT_OFFSET(pp, pp);
-NET_IOV_ASSERT_OFFSET(_pp_mapping_pad, _pp_mapping_pad);
-NET_IOV_ASSERT_OFFSET(dma_addr, dma_addr);
-NET_IOV_ASSERT_OFFSET(pp_ref_count, pp_ref_count);
-#undef NET_IOV_ASSERT_OFFSET
-
 static inline struct net_iov_area *net_iov_owner(const struct net_iov *niov)
 {
 	return niov->owner;
-- 
2.17.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH net-next] netmem: remove the pp fields from net_iov
  2026-02-24  6:14 [RESEND PATCH net-next] netmem: remove the pp fields from net_iov Byungchul Park
@ 2026-02-25  9:14 ` Simon Horman
  2026-02-25  9:25 ` Pavel Begunkov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2026-02-25  9:14 UTC (permalink / raw)
  To: Byungchul Park
  Cc: netdev, linux-kernel, linux-mm, kernel_team, harry.yoo, hawk,
	andrew+netdev, david, lorenzo.stoakes, Liam.Howlett, vbabka, ziy,
	willy, toke, davem, edumazet, kuba, pabeni, asml.silence, axboe,
	ncardwell, kuniyu, dsahern, almasrymina, sdf, dw, ap420073,
	dtatulea, shivajikant, io-uring

On Tue, Feb 24, 2026 at 03:14:24PM +0900, Byungchul Park wrote:
> Now that the pp fields in net_iov have no users, remove them from
> net_iov and clean up.
> 
> Signed-off-by: Byungchul Park <byungchul@sk.com>

Reviewed-by: Simon Horman <horms@kernel.org>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH net-next] netmem: remove the pp fields from net_iov
  2026-02-24  6:14 [RESEND PATCH net-next] netmem: remove the pp fields from net_iov Byungchul Park
  2026-02-25  9:14 ` Simon Horman
@ 2026-02-25  9:25 ` Pavel Begunkov
  2026-02-25  9:43 ` Toke Høiland-Jørgensen
  2026-02-25 17:57 ` Mina Almasry
  3 siblings, 0 replies; 5+ messages in thread
From: Pavel Begunkov @ 2026-02-25  9:25 UTC (permalink / raw)
  To: Byungchul Park, netdev
  Cc: linux-kernel, linux-mm, kernel_team, harry.yoo, hawk,
	andrew+netdev, david, lorenzo.stoakes, Liam.Howlett, vbabka, ziy,
	willy, toke, davem, edumazet, kuba, pabeni, horms, axboe,
	ncardwell, kuniyu, dsahern, almasrymina, sdf, dw, ap420073,
	dtatulea, shivajikant, io-uring

On 2/24/26 06:14, Byungchul Park wrote:
> Now that the pp fields in net_iov have no users, remove them from
> net_iov and clean up.

Looks good, it's great to get rid of all this aliasing.

Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>

-- 
Pavel Begunkov



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH net-next] netmem: remove the pp fields from net_iov
  2026-02-24  6:14 [RESEND PATCH net-next] netmem: remove the pp fields from net_iov Byungchul Park
  2026-02-25  9:14 ` Simon Horman
  2026-02-25  9:25 ` Pavel Begunkov
@ 2026-02-25  9:43 ` Toke Høiland-Jørgensen
  2026-02-25 17:57 ` Mina Almasry
  3 siblings, 0 replies; 5+ messages in thread
From: Toke Høiland-Jørgensen @ 2026-02-25  9:43 UTC (permalink / raw)
  To: Byungchul Park, netdev
  Cc: linux-kernel, linux-mm, kernel_team, harry.yoo, hawk,
	andrew+netdev, david, lorenzo.stoakes, Liam.Howlett, vbabka, ziy,
	willy, davem, edumazet, kuba, pabeni, horms, asml.silence, axboe,
	ncardwell, kuniyu, dsahern, almasrymina, sdf, dw, ap420073,
	dtatulea, shivajikant, io-uring

Byungchul Park <byungchul@sk.com> writes:

> Now that the pp fields in net_iov have no users, remove them from
> net_iov and clean up.
>
> Signed-off-by: Byungchul Park <byungchul@sk.com>

Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH net-next] netmem: remove the pp fields from net_iov
  2026-02-24  6:14 [RESEND PATCH net-next] netmem: remove the pp fields from net_iov Byungchul Park
                   ` (2 preceding siblings ...)
  2026-02-25  9:43 ` Toke Høiland-Jørgensen
@ 2026-02-25 17:57 ` Mina Almasry
  3 siblings, 0 replies; 5+ messages in thread
From: Mina Almasry @ 2026-02-25 17:57 UTC (permalink / raw)
  To: Byungchul Park
  Cc: netdev, linux-kernel, linux-mm, kernel_team, harry.yoo, hawk,
	andrew+netdev, david, lorenzo.stoakes, Liam.Howlett, vbabka, ziy,
	willy, toke, davem, edumazet, kuba, pabeni, horms, asml.silence,
	axboe, ncardwell, kuniyu, dsahern, sdf, dw, ap420073, dtatulea,
	shivajikant, io-uring

On Mon, Feb 23, 2026 at 10:14 PM Byungchul Park <byungchul@sk.com> wrote:
>
> Now that the pp fields in net_iov have no users, remove them from
> net_iov and clean up.
>
> Signed-off-by: Byungchul Park <byungchul@sk.com>
> ---
> The original post was:
>
>   https://lore.kernel.org/all/20251121040047.71921-1-byungchul@sk.com/
>
> 1/3 was covered by Pavel's patch:
>
>   commit f0243d2b86b97 ("io_uring/zcrx: convert to use netmem_desc").
>
> 2/3 was taken by Jakub and merged:
>
>   commit df59bb5b9af3f ("netmem, devmem, tcp: access pp fields through
>   @desc in net_iov")
>
> Now that io-uring and net core changes converge in one tree, I'm
> resending the 3/3, which is what Jakub asked:
>
>   https://lore.kernel.org/all/20251124184729.7e365941@kernel.org/
> ---
>  include/net/netmem.h | 38 +-------------------------------------
>  1 file changed, 1 insertion(+), 37 deletions(-)
>
> diff --git a/include/net/netmem.h b/include/net/netmem.h
> index a96b3e5e5574..a6d65ced5231 100644
> --- a/include/net/netmem.h
> +++ b/include/net/netmem.h
> @@ -93,23 +93,7 @@ enum net_iov_type {
>   *             supported.
>   */
>  struct net_iov {
> -       union {
> -               struct netmem_desc desc;
> -
> -               /* XXX: The following part should be removed once all
> -                * the references to them are converted so as to be
> -                * accessed via netmem_desc e.g. niov->desc.pp instead
> -                * of niov->pp.
> -                */
> -               struct {
> -                       unsigned long _flags;
> -                       unsigned long pp_magic;
> -                       struct page_pool *pp;
> -                       unsigned long _pp_mapping_pad;
> -                       unsigned long dma_addr;
> -                       atomic_long_t pp_ref_count;
> -               };
> -       };
> +       struct netmem_desc desc;
>         struct net_iov_area *owner;
>         enum net_iov_type type;
>  };
> @@ -123,26 +107,6 @@ struct net_iov_area {
>         unsigned long base_virtual;
>  };
>
> -/* net_iov is union'ed with struct netmem_desc mirroring struct page, so
> - * the page_pool can access these fields without worrying whether the
> - * underlying fields are accessed via netmem_desc or directly via
> - * net_iov, until all the references to them are converted so as to be
> - * accessed via netmem_desc e.g. niov->desc.pp instead of niov->pp.
> - *
> - * The non-net stack fields of struct page are private to the mm stack
> - * and must never be mirrored to net_iov.
> - */
> -#define NET_IOV_ASSERT_OFFSET(desc, iov)                    \
> -       static_assert(offsetof(struct netmem_desc, desc) == \
> -                     offsetof(struct net_iov, iov))
> -NET_IOV_ASSERT_OFFSET(_flags, _flags);
> -NET_IOV_ASSERT_OFFSET(pp_magic, pp_magic);
> -NET_IOV_ASSERT_OFFSET(pp, pp);
> -NET_IOV_ASSERT_OFFSET(_pp_mapping_pad, _pp_mapping_pad);
> -NET_IOV_ASSERT_OFFSET(dma_addr, dma_addr);
> -NET_IOV_ASSERT_OFFSET(pp_ref_count, pp_ref_count);
> -#undef NET_IOV_ASSERT_OFFSET
> -

Probably better to retain an assert that netmem_desc is the first
field in struct net_iov, no?

There technically is no assert that netmem_desc is the first field of
struct page, but it's generally well understood that the memory
descriptor types should be the first field of struct page. It's not
well understand that the netmem_desc type should be the first field in
struct net_iov though.

--
Thanks,
Mina


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-02-25 17:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-24  6:14 [RESEND PATCH net-next] netmem: remove the pp fields from net_iov Byungchul Park
2026-02-25  9:14 ` Simon Horman
2026-02-25  9:25 ` Pavel Begunkov
2026-02-25  9:43 ` Toke Høiland-Jørgensen
2026-02-25 17:57 ` Mina Almasry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox