From: Wei Yang <richard.weiyang@gmail.com>
To: Zi Yan <ziy@nvidia.com>
Cc: Wei Yang <richard.weiyang@gmail.com>,
akpm@linux-foundation.org, linux-mm@kvack.org,
Johannes Weiner <hannes@cmpxchg.org>,
Vlastimil Babka <vbabka@suse.cz>,
David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH] mm/page_alloc: find_large_buddy() from start_pfn aligned order
Date: Sat, 30 Aug 2025 02:15:06 +0000 [thread overview]
Message-ID: <20250830021506.q34jktg64h74hux7@master> (raw)
In-Reply-To: <489045AD-70D6-4167-843D-50A8DD19870B@nvidia.com>
On Thu, Aug 28, 2025 at 11:02:33PM -0400, Zi Yan wrote:
[...]
>
>BTW, I also notice that when start_pfn is an order-0 PageBuddy, the
>"if (pfn + (1 << buddy_order(page)) > start_pfn)" check below would be true
>even if there is no buddy straddles start_pfn, although "return pfn"
>gives the same results as "return start_pfn" (no straddle). The original
>code before the addition of find_large_buddy() (commit fd919a85cd55 ("mm:
>page_isolation: prepare for hygienic freelists")) checks start_pfn == pfn
>before the straddle check, so the correct code should check start_pfn == pfn
>and return early. But since current code is functionally equivalent.
>Maybe adding a comment about it would be sufficient. Something like:
>
>When the found buddy order is 0, the check would give false positive,
>but the returned result is still correct, since pfn is the same as start_pfn.
Hm... found another thing.
In __move_freepages_block_isolate(), when checking "We're the starting block
of a large buddy", variable "page" may not be the large buddy page we found
from find_large_buddy(). Since prep_move_freepages_block() set start_pfn to
pageblock_start_pfn(page_to_pfn(page)), which may be different.
--
Wei Yang
Help you, Help me
prev parent reply other threads:[~2025-08-30 2:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-28 9:16 Wei Yang
2025-08-29 3:02 ` Zi Yan
2025-08-30 1:25 ` Wei Yang
2025-08-30 3:20 ` Vishal Moola (Oracle)
2025-08-30 7:48 ` Wei Yang
2025-08-31 1:28 ` Zi Yan
2025-08-31 3:35 ` Wei Yang
2025-08-30 2:15 ` Wei Yang [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=20250830021506.q34jktg64h74hux7@master \
--to=richard.weiyang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=vbabka@suse.cz \
--cc=ziy@nvidia.com \
/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