Skip to content

Commit 761d79f

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
mm: convert isolate_page() to mf_isolate_folio()
The only caller now has a folio, so pass it in and operate on it. Saves many page->folio conversions and introduces only one folio->page conversion when calling isolate_movable_page(). Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Cc: Naoya Horiguchi <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 049b260 commit 761d79f

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

mm/memory-failure.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,37 +2602,37 @@ int unpoison_memory(unsigned long pfn)
26022602
}
26032603
EXPORT_SYMBOL(unpoison_memory);
26042604

2605-
static bool isolate_page(struct page *page, struct list_head *pagelist)
2605+
static bool mf_isolate_folio(struct folio *folio, struct list_head *pagelist)
26062606
{
26072607
bool isolated = false;
26082608

2609-
if (PageHuge(page)) {
2610-
isolated = isolate_hugetlb(page_folio(page), pagelist);
2609+
if (folio_test_hugetlb(folio)) {
2610+
isolated = isolate_hugetlb(folio, pagelist);
26112611
} else {
2612-
bool lru = !__PageMovable(page);
2612+
bool lru = !__folio_test_movable(folio);
26132613

26142614
if (lru)
2615-
isolated = isolate_lru_page(page);
2615+
isolated = folio_isolate_lru(folio);
26162616
else
2617-
isolated = isolate_movable_page(page,
2617+
isolated = isolate_movable_page(&folio->page,
26182618
ISOLATE_UNEVICTABLE);
26192619

26202620
if (isolated) {
2621-
list_add(&page->lru, pagelist);
2621+
list_add(&folio->lru, pagelist);
26222622
if (lru)
2623-
inc_node_page_state(page, NR_ISOLATED_ANON +
2624-
page_is_file_lru(page));
2623+
node_stat_add_folio(folio, NR_ISOLATED_ANON +
2624+
folio_is_file_lru(folio));
26252625
}
26262626
}
26272627

26282628
/*
2629-
* If we succeed to isolate the page, we grabbed another refcount on
2630-
* the page, so we can safely drop the one we got from get_any_page().
2631-
* If we failed to isolate the page, it means that we cannot go further
2629+
* If we succeed to isolate the folio, we grabbed another refcount on
2630+
* the folio, so we can safely drop the one we got from get_any_page().
2631+
* If we failed to isolate the folio, it means that we cannot go further
26322632
* and we will return an error, so drop the reference we got from
26332633
* get_any_page() as well.
26342634
*/
2635-
put_page(page);
2635+
folio_put(folio);
26362636
return isolated;
26372637
}
26382638

@@ -2686,7 +2686,7 @@ static int soft_offline_in_use_page(struct page *page)
26862686
return 0;
26872687
}
26882688

2689-
if (isolate_page(&folio->page, &pagelist)) {
2689+
if (mf_isolate_folio(folio, &pagelist)) {
26902690
ret = migrate_pages(&pagelist, alloc_migration_target, NULL,
26912691
(unsigned long)&mtc, MIGRATE_SYNC, MR_MEMORY_FAILURE, NULL);
26922692
if (!ret) {

0 commit comments

Comments
 (0)