Skip to content

Commit 85fbe5d

Browse files
Yisheng Xietorvalds
authored andcommitted
HWPOISON: soft offlining for non-lru movable page
Extend soft offlining framework to support non-lru page, which already support migration after commit bda807d ("mm: migrate: support non-lru movable page migration") When memory corrected errors occur on a non-lru movable page, we can choose to stop using it by migrating data onto another page and disable the original (maybe half-broken) one. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Yisheng Xie <[email protected]> Suggested-by: Michal Hocko <[email protected]> Suggested-by: Minchan Kim <[email protected]> Reviewed-by: Minchan Kim <[email protected]> Acked-by: Naoya Horiguchi <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Hanjun Guo <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Joonsoo Kim <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Reza Arbab <[email protected]> Cc: Taku Izumi <[email protected]> Cc: Vitaly Kuznetsov <[email protected]> Cc: Xishi Qiu <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent cbae017 commit 85fbe5d

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

mm/memory-failure.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,8 @@ static int get_any_page(struct page *page, unsigned long pfn, int flags)
15271527
{
15281528
int ret = __get_any_page(page, pfn, flags);
15291529

1530-
if (ret == 1 && !PageHuge(page) && !PageLRU(page)) {
1530+
if (ret == 1 && !PageHuge(page) &&
1531+
!PageLRU(page) && !__PageMovable(page)) {
15311532
/*
15321533
* Try to free it.
15331534
*/
@@ -1649,26 +1650,31 @@ static int __soft_offline_page(struct page *page, int flags)
16491650
* Try to migrate to a new page instead. migrate.c
16501651
* handles a large number of cases for us.
16511652
*/
1652-
ret = isolate_lru_page(page);
1653+
if (PageLRU(page))
1654+
ret = isolate_lru_page(page);
1655+
else
1656+
ret = isolate_movable_page(page, ISOLATE_UNEVICTABLE);
16531657
/*
16541658
* Drop page reference which is came from get_any_page()
16551659
* successful isolate_lru_page() already took another one.
16561660
*/
16571661
put_hwpoison_page(page);
16581662
if (!ret) {
16591663
LIST_HEAD(pagelist);
1660-
inc_node_page_state(page, NR_ISOLATED_ANON +
1661-
page_is_file_cache(page));
1664+
/*
1665+
* After isolated lru page, the PageLRU will be cleared,
1666+
* so use !__PageMovable instead for LRU page's mapping
1667+
* cannot have PAGE_MAPPING_MOVABLE.
1668+
*/
1669+
if (!__PageMovable(page))
1670+
inc_node_page_state(page, NR_ISOLATED_ANON +
1671+
page_is_file_cache(page));
16621672
list_add(&page->lru, &pagelist);
16631673
ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL,
16641674
MIGRATE_SYNC, MR_MEMORY_FAILURE);
16651675
if (ret) {
1666-
if (!list_empty(&pagelist)) {
1667-
list_del(&page->lru);
1668-
dec_node_page_state(page, NR_ISOLATED_ANON +
1669-
page_is_file_cache(page));
1670-
putback_lru_page(page);
1671-
}
1676+
if (!list_empty(&pagelist))
1677+
putback_movable_pages(&pagelist);
16721678

16731679
pr_info("soft offline: %#lx: migration failed %d, type %lx\n",
16741680
pfn, ret, page->flags);

0 commit comments

Comments
 (0)