Skip to content

Commit 049b260

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
mm: convert soft_offline_in_use_page() to use a folio
Replace the existing head-page logic with folio logic. 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 19369d8 commit 049b260

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

mm/memory-failure.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2645,48 +2645,48 @@ static int soft_offline_in_use_page(struct page *page)
26452645
{
26462646
long ret = 0;
26472647
unsigned long pfn = page_to_pfn(page);
2648-
struct page *hpage = compound_head(page);
2648+
struct folio *folio = page_folio(page);
26492649
char const *msg_page[] = {"page", "hugepage"};
2650-
bool huge = PageHuge(page);
2650+
bool huge = folio_test_hugetlb(folio);
26512651
LIST_HEAD(pagelist);
26522652
struct migration_target_control mtc = {
26532653
.nid = NUMA_NO_NODE,
26542654
.gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL,
26552655
};
26562656

2657-
if (!huge && PageTransHuge(hpage)) {
2657+
if (!huge && folio_test_large(folio)) {
26582658
if (try_to_split_thp_page(page)) {
26592659
pr_info("soft offline: %#lx: thp split failed\n", pfn);
26602660
return -EBUSY;
26612661
}
2662-
hpage = page;
2662+
folio = page_folio(page);
26632663
}
26642664

2665-
lock_page(page);
2665+
folio_lock(folio);
26662666
if (!huge)
2667-
wait_on_page_writeback(page);
2667+
folio_wait_writeback(folio);
26682668
if (PageHWPoison(page)) {
2669-
unlock_page(page);
2670-
put_page(page);
2669+
folio_unlock(folio);
2670+
folio_put(folio);
26712671
pr_info("soft offline: %#lx page already poisoned\n", pfn);
26722672
return 0;
26732673
}
26742674

2675-
if (!huge && PageLRU(page) && !PageSwapCache(page))
2675+
if (!huge && folio_test_lru(folio) && !folio_test_swapcache(folio))
26762676
/*
26772677
* Try to invalidate first. This should work for
26782678
* non dirty unmapped page cache pages.
26792679
*/
2680-
ret = invalidate_inode_page(page);
2681-
unlock_page(page);
2680+
ret = mapping_evict_folio(folio_mapping(folio), folio);
2681+
folio_unlock(folio);
26822682

26832683
if (ret) {
26842684
pr_info("soft_offline: %#lx: invalidated\n", pfn);
26852685
page_handle_poison(page, false, true);
26862686
return 0;
26872687
}
26882688

2689-
if (isolate_page(hpage, &pagelist)) {
2689+
if (isolate_page(&folio->page, &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)