Merge "mm/hotplug: enable memory hotplug for non-lru movable pages"
This commit is contained in:
commit
b36bac6b0d
2 changed files with 23 additions and 15 deletions
|
@ -1423,10 +1423,10 @@ int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan pfn range [start,end) to find movable/migratable pages (LRU pages
|
* Scan pfn range [start,end) to find movable/migratable pages (LRU pages,
|
||||||
* and hugepages). We scan pfn because it's much easier than scanning over
|
* non-lru movable pages and hugepages). We scan pfn because it's much
|
||||||
* linked list. This function returns the pfn of the first found movable
|
* easier than scanning over linked list. This function returns the pfn
|
||||||
* page if it's found, otherwise 0.
|
* of the first found movable page if it's found, otherwise 0.
|
||||||
*/
|
*/
|
||||||
static unsigned long scan_movable_pages(unsigned long start, unsigned long end)
|
static unsigned long scan_movable_pages(unsigned long start, unsigned long end)
|
||||||
{
|
{
|
||||||
|
@ -1437,6 +1437,8 @@ static unsigned long scan_movable_pages(unsigned long start, unsigned long end)
|
||||||
page = pfn_to_page(pfn);
|
page = pfn_to_page(pfn);
|
||||||
if (PageLRU(page))
|
if (PageLRU(page))
|
||||||
return pfn;
|
return pfn;
|
||||||
|
if (__PageMovable(page))
|
||||||
|
return pfn;
|
||||||
if (PageHuge(page)) {
|
if (PageHuge(page)) {
|
||||||
if (page_huge_active(page))
|
if (page_huge_active(page))
|
||||||
return pfn;
|
return pfn;
|
||||||
|
@ -1480,22 +1482,24 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
|
||||||
if (!get_page_unless_zero(page))
|
if (!get_page_unless_zero(page))
|
||||||
continue;
|
continue;
|
||||||
/*
|
/*
|
||||||
* We can skip free pages. And we can only deal with pages on
|
* We can skip free pages. And we can deal with pages on
|
||||||
* LRU.
|
* LRU and non-lru movable pages.
|
||||||
*/
|
*/
|
||||||
ret = isolate_lru_page(page);
|
if (PageLRU(page))
|
||||||
|
ret = isolate_lru_page(page);
|
||||||
|
else
|
||||||
|
ret = isolate_movable_page(page, ISOLATE_UNEVICTABLE);
|
||||||
if (!ret) { /* Success */
|
if (!ret) { /* Success */
|
||||||
put_page(page);
|
put_page(page);
|
||||||
list_add_tail(&page->lru, &source);
|
list_add_tail(&page->lru, &source);
|
||||||
move_pages--;
|
move_pages--;
|
||||||
inc_zone_page_state(page, NR_ISOLATED_ANON +
|
if (!__PageMovable(page))
|
||||||
page_is_file_cache(page));
|
inc_zone_page_state(page, NR_ISOLATED_ANON +
|
||||||
|
page_is_file_cache(page));
|
||||||
} else {
|
} else {
|
||||||
#ifdef CONFIG_DEBUG_VM
|
#ifdef CONFIG_DEBUG_VM
|
||||||
printk(KERN_ALERT "removing pfn %lx from LRU failed\n",
|
pr_alert("failed to isolate pfn %lx\n", pfn);
|
||||||
pfn);
|
dump_page(page, "isolation failed");
|
||||||
dump_page(page, "failed to remove from LRU");
|
|
||||||
#endif
|
#endif
|
||||||
put_page(page);
|
put_page(page);
|
||||||
/* Because we don't have big zone->lock. we should
|
/* Because we don't have big zone->lock. we should
|
||||||
|
|
|
@ -6652,8 +6652,9 @@ void set_pfnblock_flags_mask(struct page *page, unsigned long flags,
|
||||||
* If @count is not zero, it is okay to include less @count unmovable pages
|
* If @count is not zero, it is okay to include less @count unmovable pages
|
||||||
*
|
*
|
||||||
* PageLRU check without isolation or lru_lock could race so that
|
* PageLRU check without isolation or lru_lock could race so that
|
||||||
* MIGRATE_MOVABLE block might include unmovable pages. It means you can't
|
* MIGRATE_MOVABLE block might include unmovable pages. And __PageMovable
|
||||||
* expect this function should be exact.
|
* check without lock_page also may miss some movable non-lru pages at
|
||||||
|
* race condition. So you can't expect this function should be exact.
|
||||||
*/
|
*/
|
||||||
bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
|
bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
|
||||||
bool skip_hwpoisoned_pages)
|
bool skip_hwpoisoned_pages)
|
||||||
|
@ -6709,6 +6710,9 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
|
||||||
if (skip_hwpoisoned_pages && PageHWPoison(page))
|
if (skip_hwpoisoned_pages && PageHWPoison(page))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (__PageMovable(page))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!PageLRU(page))
|
if (!PageLRU(page))
|
||||||
found++;
|
found++;
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue