From: sashiko-bot@kernel.org
To: "Mina Almasry" <almasrymina@google.com>
Cc: virtualization@lists.linux.dev, linux-rdma@vger.kernel.org,
"Michael S. Tsirkin" <mst@redhat.com>,
"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH net-next v2 3/5] tcp: detach page_pool pages before mapping in tcp_zerocopy_receive()
Date: Mon, 09 Nov 2026 06:00:42 +0000 [thread overview]
Message-ID: <sashiko-outbox-204472@kernel.org> (raw)
In-Reply-To: <20261108060016.2131509-4-almasrymina@google.com>
> Once tcp_zerocopy_receive() maps an order-0 RX fragment page into a
> userspace VMA via vm_insert_pages(), vm_insert_pages() increments
> page->_refcount, which prevents the page from being recycled back into
> its page_pool when the RX SKB is freed. However, while the RX SKB still
> holds its fragment reference, the page remains marked as a page_pool
> page (page_pool_page_is_pp(page) == true) inside the userspace VMA, so
> subsequent GUP callers such as sendmsg(MSG_ZEROCOPY) or vmsplice() can
> encounter a page_pool page while holding only a raw struct page
> reference.
>
> Establish the invariant that pp_ref_count is only incremented by callers
> that already hold an active pp_ref_count (>= 1) on that netmem, and a
> raw page_ref_count is never converted into a pp_ref_count:
> - In can_map_frag(), require !skb_cloned(skb), page_pool_ref_count == 1,
> and page_ref_count == 1 for page_pool pages so the fragment being
> mapped holds the sole reference to the page; cloned SKBs or page_pool
> pages with additional references (including drivers holding an
> undrained fragment bias) fall back to copying.
> - In tcp_zerocopy_receive(), convert the fragment's sole pp_ref_count
> into a regular page reference and detach the page from its page_pool
> via get_page(page) + napi_pp_put_page(page_to_netmem(page)) before
> queueing the page for vm_insert_pages(). If vm_insert_pages()
> subsequently fails, the detached page remains referenced by the RX SKB
> via its regular page reference and is freed back to the page allocator
> when the SKB is consumed.
>
> Signed-off-by: Mina Almasry <almasrymina@google.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261108060016.2131509-1-almasrymina@google.com?part=3
next prev parent reply other threads:[~2026-11-09 6:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 6:00 [PATCH net-next v2 0/5] net: deprecate skb->pp_recycle and skb_mark_for_recycle() Mina Almasry
2026-11-08 6:00 ` [PATCH net-next v2 1/5] net: skbuff: skip managed zerocopy frags in skb_frag_ref() Mina Almasry
2026-11-09 6:00 ` sashiko-bot
2026-11-08 6:00 ` [PATCH net-next v2 2/5] net: skbuff: refcount spliced page_pool frags via skb_pipe_buf_ops Mina Almasry
2026-11-09 6:00 ` sashiko-bot
2026-11-08 6:00 ` [PATCH net-next v2 3/5] tcp: detach page_pool pages before mapping in tcp_zerocopy_receive() Mina Almasry
2026-11-09 6:00 ` sashiko-bot [this message]
2026-11-08 6:00 ` [PATCH net-next v2 4/5] net: remove skb->pp_recycle and consolidate netmem refcounting Mina Almasry
2026-11-09 6:00 ` sashiko-bot
2026-11-08 6:00 ` [PATCH net-next v2 5/5] net: remove skb_mark_for_recycle() Mina Almasry
2026-11-09 6:00 ` sashiko-bot
2026-11-11 1:13 ` [PATCH net-next v2 0/5] net: deprecate skb->pp_recycle and skb_mark_for_recycle() Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-204472@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=almasrymina@google.com \
--cc=eperezma@redhat.com \
--cc=linux-rdma@vger.kernel.org \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=virtualization@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.