@@ -659,7 +659,7 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
* Isolate the page to avoid collapsing an hugepage
* currently in use by the VM.
*/
- if (isolate_lru_page(page)) {
+ if (isolate_lru_page(page) < 0) {
unlock_page(page);
result = SCAN_DEL_PAGE_LRU;
goto out;
@@ -6226,7 +6226,7 @@ static int mem_cgroup_move_charge_pte_range(pmd_t *pmd,
*/
if (PageTransCompound(page))
goto put;
- if (!device && isolate_lru_page(page))
+ if (!device && isolate_lru_page(page) < 0)
goto put;
if (!mem_cgroup_move_account(page, false,
mc.from, mc.to)) {
@@ -2135,7 +2135,7 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr,
head = compound_head(page);
err = isolate_lru_page(head);
- if (err)
+ if (err < 0)
goto out_putpage;
err = 1;
@@ -2541,7 +2541,7 @@ static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)
return 0;
}
- if (isolate_lru_page(page))
+ if (isolate_lru_page(page) < 0)
return 0;
mod_node_page_state(page_pgdat(page), NR_ISOLATED_ANON + page_is_file_lru(page),
@@ -388,7 +388,7 @@ static unsigned long migrate_device_unmap(unsigned long *src_pfns,
allow_drain = false;
}
- if (isolate_lru_page(page)) {
+ if (isolate_lru_page(page) < 0) {
src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
restore++;
continue;
Better to check the negative error of isolate_lru_page() when failed to isolate a page from its LRU, which makes the code more clear. No functional changes. Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com> --- mm/khugepaged.c | 2 +- mm/memcontrol.c | 2 +- mm/migrate.c | 4 ++-- mm/migrate_device.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)