linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page_isolation: unset migratetype directly for non Buddy page
@ 2021-12-29  3:36 Chen Wandun
  2021-12-29 14:53 ` Oscar Salvador
  2022-01-14 20:50 ` Guillaume Tucker
  0 siblings, 2 replies; 5+ messages in thread
From: Chen Wandun @ 2021-12-29  3:36 UTC (permalink / raw)
  To: akpm, vbabka, iamjoonsoo.kim, linux-mm, linux-kernel; +Cc: wangkefeng.wang

There is no need to try to move_freepages_block for pages that is not
in buddy in function unset_migratetype_isolate, it can directly set
migrate type.

It will save a few cpu cycles for some situations such as cma and
hugetlb when allocating continue pages, in these situation function
alloc_contig_pages will be called.

alloc_contig_pages
	__alloc_contig_migrate_range
	isolate_freepages_range ==> pages has been remove from buddy
	undo_isolate_page_range
		unset_migratetype_isolate ==> can directly set migratetype

Fixes: 3c605096d315 ("mm/page_alloc: restrict max order of merging on isolated pageblock")
Signed-off-by: Chen Wandun <chenwandun@huawei.com>
---
 mm/page_isolation.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index f67c4c70f17f..6a0ddda6b3c5 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
 	 * onlining - just onlined memory won't immediately be considered for
 	 * allocation.
 	 */
-	if (!isolated_page) {
+	if (!isolated_page && PageBuddy(page)) {
 		nr_pages = move_freepages_block(zone, page, migratetype, NULL);
 		__mod_zone_freepage_state(zone, nr_pages, migratetype);
 	}
-- 
2.18.0.huawei.25



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

end of thread, other threads:[~2022-01-17  6:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-29  3:36 [PATCH] mm/page_isolation: unset migratetype directly for non Buddy page Chen Wandun
2021-12-29 14:53 ` Oscar Salvador
2022-01-14 20:50 ` Guillaume Tucker
2022-01-17  3:48   ` Chen Wandun
2022-01-17  6:29   ` Chen Wandun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox