Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356546
b: refs/heads/master
c: 0ebff32
h: refs/heads/master
v: v3
  • Loading branch information
Xishi Qiu authored and Linus Torvalds committed Feb 24, 2013
1 parent 780ffff commit 22a8efd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 194159fbcc0d6ac1351837d3cd7a27a4af0219a6
refs/heads/master: 0ebff32c3637e0ed551c017eb9599ac108ab36aa
38 changes: 17 additions & 21 deletions trunk/mm/memory-failure.c
Original file line number Diff line number Diff line change
Expand Up @@ -1419,18 +1419,17 @@ static int soft_offline_huge_page(struct page *page, int flags)
unsigned long pfn = page_to_pfn(page);
struct page *hpage = compound_head(page);

if (PageHWPoison(hpage)) {
pr_info("soft offline: %#lx hugepage already poisoned\n", pfn);
return -EBUSY;
}

ret = get_any_page(page, pfn, flags);
if (ret < 0)
return ret;
if (ret == 0)
goto done;

if (PageHWPoison(hpage)) {
put_page(hpage);
pr_info("soft offline: %#lx hugepage already poisoned\n", pfn);
return -EBUSY;
}

/* Keep page count to indicate a given hugepage is isolated. */
ret = migrate_huge_page(hpage, new_page, MPOL_MF_MOVE_ALL, false,
MIGRATE_SYNC);
Expand All @@ -1441,12 +1440,11 @@ static int soft_offline_huge_page(struct page *page, int flags)
return ret;
}
done:
if (!PageHWPoison(hpage))
atomic_long_add(1 << compound_trans_order(hpage),
&mce_bad_pages);
/* keep elevated page count for bad page */
atomic_long_add(1 << compound_trans_order(hpage), &mce_bad_pages);
set_page_hwpoison_huge_page(hpage);
dequeue_hwpoisoned_huge_page(hpage);
/* keep elevated page count for bad page */

return ret;
}

Expand Down Expand Up @@ -1488,6 +1486,11 @@ int soft_offline_page(struct page *page, int flags)
}
}

if (PageHWPoison(page)) {
pr_info("soft offline: %#lx page already poisoned\n", pfn);
return -EBUSY;
}

ret = get_any_page(page, pfn, flags);
if (ret < 0)
return ret;
Expand Down Expand Up @@ -1519,19 +1522,11 @@ int soft_offline_page(struct page *page, int flags)
return -EIO;
}

lock_page(page);
wait_on_page_writeback(page);

/*
* Synchronized using the page lock with memory_failure()
*/
if (PageHWPoison(page)) {
unlock_page(page);
put_page(page);
pr_info("soft offline: %#lx page already poisoned\n", pfn);
return -EBUSY;
}

lock_page(page);
wait_on_page_writeback(page);
/*
* Try to invalidate first. This should work for
* non dirty unmapped page cache pages.
Expand Down Expand Up @@ -1583,8 +1578,9 @@ int soft_offline_page(struct page *page, int flags)
return ret;

done:
/* keep elevated page count for bad page */
atomic_long_add(1, &mce_bad_pages);
SetPageHWPoison(page);
/* keep elevated page count for bad page */

return ret;
}

0 comments on commit 22a8efd

Please sign in to comment.