linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page_alloc: find_large_buddy() from start_pfn aligned order
@ 2025-08-28  9:16 Wei Yang
  2025-08-29  3:02 ` Zi Yan
  0 siblings, 1 reply; 8+ messages in thread
From: Wei Yang @ 2025-08-28  9:16 UTC (permalink / raw)
  To: akpm
  Cc: linux-mm, Wei Yang, Johannes Weiner, Zi Yan, Vlastimil Babka,
	David Hildenbrand

We iterate pfn from order 0 to MAX_PAGE_ORDER aligned to find large
buddy. While if the order is less than start_pfn aligned order, we would
get the same pfn and do the same check again.

Iterate from start_pfn aligned order to reduce duplicated work.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: David Hildenbrand <david@redhat.com>

---
I build this and run, but not sure how fully test this.
---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 27ea4c7acd15..7f2dfd30106f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2033,7 +2033,7 @@ static int move_freepages_block(struct zone *zone, struct page *page,
 /* Look for a buddy that straddles start_pfn */
 static unsigned long find_large_buddy(unsigned long start_pfn)
 {
-	int order = 0;
+	int order = start_pfn ? __ffs(start_pfn) : MAX_PAGE_ORDER;
 	struct page *page;
 	unsigned long pfn = start_pfn;
 
-- 
2.34.1



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

end of thread, other threads:[~2025-08-31  3:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-28  9:16 [PATCH] mm/page_alloc: find_large_buddy() from start_pfn aligned order 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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox