Re: [PATCH] io_uring/net: don't charge the folio offset to truesize for managed frags

From: Brian Martin

Date: Thu Nov 19 2026 - 19:11:23 EST


On Thu, 19 Nov 2026 23:29:35 +0000, Louis Thiery wrote:
> Only the in-page part of the offset matters for how much memory a
> fragment ties up, so use offset_in_page().

This is the change suggested in my report earlier today:

https://lore.kernel.org/io-uring/CAC+fX10wVVSqGnfCg+aazorsCxB34sUDV-XJiBPd6R3Kuqc-7Q@xxxxxxxxxxxxxx/

I applied this patch to io_uring-7.4 (0659e44ce739) and ran the
reproducer from that report. With it, SEND_ZC from a registered huge-page
buffer is charged the same as SEND_ZC without one on every row, for
hugetlb and THP, including 8192 for a send that crosses a page boundary.
On the stock kernel the same run shows the overcharge.

Jens, if you apply this, could you add:

Reported-by: Brian Martin <brayniac@xxxxxxxxx>
Closes: https://lore.kernel.org/io-uring/CAC+fX10wVVSqGnfCg+aazorsCxB34sUDV-XJiBPd6R3Kuqc-7Q@xxxxxxxxxxxxxx/

Tested-by: Brian Martin <brayniac@xxxxxxxxx>