History

mm/hotplug: fix offline undo_isolate_page_range()

Commit 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 commit 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. [cai@lca.pw: v4] Link: http://lkml.kernel.org/r/20190314150641.59358-1-cai@lca.pw Link: http://lkml.kernel.org/r/20190313143133.46200-1-cai@lca.pw Fixes: 2ce13640b3f4 ("mm: __first_valid_page skip over offline pages") Signed-off-by: Qian Cai <cai@lca.pw> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: Oscar Salvador <osalvador@suse.de> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: <stable@vger.kernel.org> [4.13+] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Qian Cai committed 7 years ago

Commit 9b7ea461 parent 73601ea5 files · +45 −34Browse files

Showing the changes to include/linux (1 of 5 files). Show all

Unified · Split

include/linux/page-isolation.h+0−10
@@ -41,16 +41,6 @@ int move_freepages_block(struct zone *zone, struct page *page, · 40 unmodified lines
4141
4242 /*
4343 * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE.
44− * If specified range includes migrate types other than MOVABLE or CMA,
45− * this will fail with -EBUSY.
46− *
47− * For isolating all pages in the range finally, the caller have to
48− * free all pages in the range. test_page_isolated() can be used for
49− * test it.
50− *
51− * The following flags are allowed (they can be combined in a bit mask)
52− * SKIP_HWPOISON - ignore hwpoison pages
53− * REPORT_FAILURE - report details about the failure to isolate the range
5444 */
5545 int
5646 start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t