mm-hotplug-fix-offline-undo_isolate_page_range.patch removed from -mm tree
The patch titled
Subject: mm/hotplug: fix offline undo_isolate_page_range()
has been removed from the -mm tree. Its filename was
mm-hotplug-fix-offline-undo_isolate_page_range.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Qian Cai <[email protected]>
Subject: mm/hotplug: fix offline undo_isolate_page_range()
f1dd2cd13c4b ("mm, memory_hotplug: do not associate hotadded memory to zones until online") introduced move_pfn_range_to_zone() which calls memmap_init_zone() during onlining a memory block. memmap_init_zone() will reset pagetype flags and makes migrate type to be MOVABLE.
However, in __offline_pages(), it also call undo_isolate_page_range() after offline_isolated_pages() to do the same thing. Due to 2ce13640b3f4 ("mm: __first_valid_page skip over offline pages") changed __first_valid_page() to skip offline pages, undo_isolate_page_range() here just waste CPU cycles looping around the offlining PFN range while doing nothing, because __first_valid_page() will return NULL as offline_isolated_pages() has already marked all memory sections within the pfn range as offline via offline_mem_sections().
Also, after calling the "useless" undo_isolate_page_range() here, it reaches the point of no returning by notifying MEM_OFFLINE. Those pages will be marked as MIGRATE_MOVABLE again once onlining. The only thing left to do is to decrease the number of isolated pageblocks zone counter which would make some paths of the page allocation slower that the above commit introduced.
Even if alloc_contig_range() can be used to isolate 16GB-hugetlb pages on ppc64, an "int" should still be enough to represent the number of pageblocks there. Fix an incorrect comment along the way.
---
include/linux/page-isolation.h | 10 ------ mm/memory_hotplug.c | 17 ++++++++-- mm/page_alloc.c | 2 - mm/page_isolation.c | 48 +++++++++++++++++++------------ mm/sparse.c | 2 - 5 files changed, 45 insertions(+), 34 deletions(-)
include/linux/page-isolation.h renamed from include/linux/page-isolation.h~mm-hotplug-fix-offline-undo_isolate_page_range +0 -10
@@ -41,16 +41,6 @@ int move_freepages_block(struct zone *zo/* * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE. -* If specified range includes migrate types other than MOVABLE or CMA, -* this will fail with -EBUSY. -* -* For isolating all pages in the range finally, the caller have to -* free all pages in the range. test_page_isolated() can be used for -* test it. -* -* The following flags are allowed (they can be combined in a bit mask) -* SKIP_HWPOISON - ignore hwpoison pages -* REPORT_FAILURE - report details about the failure to isolate the range */ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
mm/memory_hotplug.c renamed from mm/memory_hotplug.c~mm-hotplug-fix-offline-undo_isolate_page_range +13 -4
@@ -1576,7 +1576,7 @@ static int __ref __offline_pages(unsigne {unsigned long pfn, nr_pages;long offlined_pages; -int ret, node; +int ret, node, nr_isolate_pageblock;unsigned long flags;unsigned long valid_start, valid_end;struct zone *zone;
@@ -1602,10 +1602,11 @@ static int __ref __offline_pages(unsigne ret =start_isolate_page_range (start_pfn, end_pfn,MIGRATE_MOVABLE ,SKIP_HWPOISON |REPORT_FAILURE ); -if (ret) { +if (ret <0 ) { reason ="failure to isolate range" ; goto failed_removal; } + nr_isolate_pageblock = ret; arg.start_pfn = start_pfn; arg.nr_pages = nr_pages;
@@ -1657,8 +1658,16 @@ static int __ref __offline_pages(unsigne/* Ok, all of our target is isolated. We cannot do rollback at this point. */ offline_isolated_pages (start_pfn, end_pfn); -/* reset pagetype flags and makes migrate type to be MOVABLE */ -undo_isolate_page_range (start_pfn, end_pfn,MIGRATE_MOVABLE ); + +/* +* Onlining will reset pagetype flags and makes migrate type +* MOVABLE, so just need to decrease the number of isolated +* pageblocks zone counter here. +*/ +spin_lock_irqsave (&zone->lock, flags); + zone->nr_isolate_pageblock -= nr_isolate_pageblock; +spin_unlock_irqrestore (&zone->lock, flags); +/* removal success */ adjust_managed_page_count (pfn_to_page (start_pfn), -offlined_pages); zone->present_pages -= offlined_pages;
mm/page_alloc.c renamed from mm/page_alloc.c~mm-hotplug-fix-offline-undo_isolate_page_range +1 -1
@@ -8233,7 +8233,7 @@ int alloc_contig_range(unsigned long sta ret =start_isolate_page_range (pfn_max_align_down (start),pfn_max_align_up (end), migratetype,0 ); -if (ret) +if (ret <0 )return ret;/*
mm/page_isolation.c renamed from mm/page_isolation.c~mm-hotplug-fix-offline-undo_isolate_page_range +30 -18
76 lines not on this page · raw message
mm/sparse.c renamed from mm/sparse.c~mm-hotplug-fix-offline-undo_isolate_page_range +1 -1
@@ -567,7 +567,7 @@ void online_mem_sections(unsigned long s }#ifdef CONFIG_MEMORY_HOTREMOVE -/* Mark all memory sections within the pfn range as online */ +/* Mark all memory sections within the pfn range as offline */ void offline_mem_sections (unsigned long start_pfn,unsigned long end_pfn) {unsigned long pfn;
_
Patches currently in -mm which might be from [email protected] are
mm-compaction-abort-search-if-isolation-fails-v2.patch mm-compaction-fix-an-undefined-behaviour.patch initramfs-cleanup-populate_rootfs-fix.patch