@@ -1531,10 +1531,10 @@ int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn,
1531
1531
}
1532
1532
1533
1533
/*
1534
- * Scan pfn range [start,end) to find movable/migratable pages (LRU pages
1535
- * and hugepages). We scan pfn because it's much easier than scanning over
1536
- * linked list. This function returns the pfn of the first found movable
1537
- * page if it's found, otherwise 0.
1534
+ * Scan pfn range [start,end) to find movable/migratable pages (LRU pages,
1535
+ * non-lru movable pages and hugepages). We scan pfn because it's much
1536
+ * easier than scanning over linked list. This function returns the pfn
1537
+ * of the first found movable page if it's found, otherwise 0.
1538
1538
*/
1539
1539
static unsigned long scan_movable_pages (unsigned long start , unsigned long end )
1540
1540
{
@@ -1545,6 +1545,8 @@ static unsigned long scan_movable_pages(unsigned long start, unsigned long end)
1545
1545
page = pfn_to_page (pfn );
1546
1546
if (PageLRU (page ))
1547
1547
return pfn ;
1548
+ if (__PageMovable (page ))
1549
+ return pfn ;
1548
1550
if (PageHuge (page )) {
1549
1551
if (page_huge_active (page ))
1550
1552
return pfn ;
@@ -1621,21 +1623,25 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
1621
1623
if (!get_page_unless_zero (page ))
1622
1624
continue ;
1623
1625
/*
1624
- * We can skip free pages. And we can only deal with pages on
1625
- * LRU.
1626
+ * We can skip free pages. And we can deal with pages on
1627
+ * LRU and non-lru movable pages .
1626
1628
*/
1627
- ret = isolate_lru_page (page );
1629
+ if (PageLRU (page ))
1630
+ ret = isolate_lru_page (page );
1631
+ else
1632
+ ret = isolate_movable_page (page , ISOLATE_UNEVICTABLE );
1628
1633
if (!ret ) { /* Success */
1629
1634
put_page (page );
1630
1635
list_add_tail (& page -> lru , & source );
1631
1636
move_pages -- ;
1632
- inc_node_page_state (page , NR_ISOLATED_ANON +
1633
- page_is_file_cache (page ));
1637
+ if (!__PageMovable (page ))
1638
+ inc_node_page_state (page , NR_ISOLATED_ANON +
1639
+ page_is_file_cache (page ));
1634
1640
1635
1641
} else {
1636
1642
#ifdef CONFIG_DEBUG_VM
1637
- pr_alert ("removing pfn %lx from LRU failed \n" , pfn );
1638
- dump_page (page , "failed to remove from LRU " );
1643
+ pr_alert ("failed to isolate pfn %lx\n" , pfn );
1644
+ dump_page (page , "isolation failed " );
1639
1645
#endif
1640
1646
put_page (page );
1641
1647
/* Because we don't have big zone->lock. we should
0 commit comments