From: Yunsheng Lin <yunshenglin0825@gmail.com>
To: Haiyang Zhang <haiyangz@microsoft.com>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Cc: Dexuan Cui <decui@microsoft.com>,
KY Srinivasan <kys@microsoft.com>,
Paul Rosswurm <paulros@microsoft.com>,
"olaf@aepfle.de" <olaf@aepfle.de>, vkuznets <vkuznets@redhat.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"wei.liu@kernel.org" <wei.liu@kernel.org>,
Long Li <longli@microsoft.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linyunsheng@huawei.com" <linyunsheng@huawei.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Alexander Duyck <alexander.duyck@gmail.com>
Subject: Re: [EXTERNAL] Re: [PATCH] mm: page_frag: Fix refill handling in __page_frag_alloc_align()
Date: Sun, 2 Mar 2025 10:22:59 +0800 [thread overview]
Message-ID: <68f83951-881f-49a6-8599-e47956b984fe@gmail.com> (raw)
In-Reply-To: <MN0PR21MB3437DB9A18F1C354963C5EF3CACF2@MN0PR21MB3437.namprd21.prod.outlook.com>
On 3/2/2025 7:16 AM, Haiyang Zhang wrote:
...
>> We are already aware of this, and have error checking in place for the
>> failover
>> case to "base page".
>>
>> From the discussion thread above, there are other drivers using
>> page_frag_alloc_align() for over PAGE_SIZE too. If making the page_frag
>> API
>> support only fragsz <= PAGE_SIZE is desired, can we create another API?
>> One
>> keeps the existing API semantics (allowing > PAGE_SIZE), the other uses
>> your new code. By the way, it should add an explicit check and fail ALL
>> requests
>> for fragsz > PAGE_SIZE. Currently your code successfully allocates big
>> frags
>> for a few times, then fail. This is not a desired behavior. It's also a
>> breaking change for our MANA driver, which can no longer run Jumbo frames.
It seems there was some memory corruption problem that may caused by
reuse of the previously allocated frag cache memory by following a
LARGER allocations before 'using initial zero offset'.
https://lore.kernel.org/netdev/b711ca5f-4180-d658-a330-89bd5dcb0acb@gmail.com/T/#m12ebdefb8ee653b281d477d2310218b4ac138cde
'using initial zero offset' seems to just make the API misuse problem
more obvious.
>>
>> @Andrew Morton <akpm@linux-foundation.org>
>> And other maintainers, could you please also evaluate the idea above?
>>
>
> And, quote from current doc 6.14.0-rc4:
> "A page fragment is an arbitrary-length arbitrary-offset area of memory
> which resides within a 0 or higher order compound page."
> https://web.git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/mm/page_frags.rst
>
> So, it is designed to be *arbitrary-length* within a 0 or higher order
> compound page.
>
> If the commit 8218f62c9c9b ("mm: page_frag: use initial zero offset for
> page_frag_alloc_align()") intended to change the existing API semantics
> to be Page Frag Length <= PAGE_SIZE, the document and all breaking drivers
> need to be updated.
Yes, updating the Documemntation to make it more obvious seems like the
right thing to do.
>
> Thanks,
> - Haiyang
>
prev parent reply other threads:[~2025-03-02 2:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-01 2:03 Haiyang Zhang
2025-03-01 13:49 ` Yunsheng Lin
2025-03-01 17:00 ` [EXTERNAL] " Haiyang Zhang
2025-03-01 23:16 ` Haiyang Zhang
2025-03-02 2:22 ` Yunsheng Lin [this message]
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=68f83951-881f-49a6-8599-e47956b984fe@gmail.com \
--to=yunshenglin0825@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.duyck@gmail.com \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linyunsheng@huawei.com \
--cc=longli@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=olaf@aepfle.de \
--cc=paulros@microsoft.com \
--cc=stable@vger.kernel.org \
--cc=vkuznets@redhat.com \
--cc=wei.liu@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox