aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory-failure.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/memory-failure.c')
-rw-r--r--mm/memory-failure.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index c6399e328931..a013bc94ebbe 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -435,7 +435,7 @@ static void collect_procs_anon(struct page *page, struct list_head *to_kill,
435 if (av == NULL) /* Not actually mapped anymore */ 435 if (av == NULL) /* Not actually mapped anymore */
436 return; 436 return;
437 437
438 pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT); 438 pgoff = page_to_pgoff(page);
439 read_lock(&tasklist_lock); 439 read_lock(&tasklist_lock);
440 for_each_process (tsk) { 440 for_each_process (tsk) {
441 struct anon_vma_chain *vmac; 441 struct anon_vma_chain *vmac;
@@ -469,7 +469,7 @@ static void collect_procs_file(struct page *page, struct list_head *to_kill,
469 mutex_lock(&mapping->i_mmap_mutex); 469 mutex_lock(&mapping->i_mmap_mutex);
470 read_lock(&tasklist_lock); 470 read_lock(&tasklist_lock);
471 for_each_process(tsk) { 471 for_each_process(tsk) {
472 pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT); 472 pgoff_t pgoff = page_to_pgoff(page);
473 struct task_struct *t = task_early_kill(tsk, force_early); 473 struct task_struct *t = task_early_kill(tsk, force_early);
474 474
475 if (!t) 475 if (!t)
@@ -895,7 +895,13 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn,
895 struct page *hpage = *hpagep; 895 struct page *hpage = *hpagep;
896 struct page *ppage; 896 struct page *ppage;
897 897
898 if (PageReserved(p) || PageSlab(p) || !PageLRU(p)) 898 /*
899 * Here we are interested only in user-mapped pages, so skip any
900 * other types of pages.
901 */
902 if (PageReserved(p) || PageSlab(p))
903 return SWAP_SUCCESS;
904 if (!(PageLRU(hpage) || PageHuge(p)))
899 return SWAP_SUCCESS; 905 return SWAP_SUCCESS;
900 906
901 /* 907 /*
@@ -905,8 +911,10 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn,
905 if (!page_mapped(hpage)) 911 if (!page_mapped(hpage))
906 return SWAP_SUCCESS; 912 return SWAP_SUCCESS;
907 913
908 if (PageKsm(p)) 914 if (PageKsm(p)) {
915 pr_err("MCE %#lx: can't handle KSM pages.\n", pfn);
909 return SWAP_FAIL; 916 return SWAP_FAIL;
917 }
910 918
911 if (PageSwapCache(p)) { 919 if (PageSwapCache(p)) {
912 printk(KERN_ERR 920 printk(KERN_ERR
@@ -1229,7 +1237,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
1229 */ 1237 */
1230 if (hwpoison_user_mappings(p, pfn, trapno, flags, &hpage) 1238 if (hwpoison_user_mappings(p, pfn, trapno, flags, &hpage)
1231 != SWAP_SUCCESS) { 1239 != SWAP_SUCCESS) {
1232 printk(KERN_ERR "MCE %#lx: cannot unmap page, give up\n", pfn); 1240 action_result(pfn, "unmapping failed", IGNORED);
1233 res = -EBUSY; 1241 res = -EBUSY;
1234 goto out; 1242 goto out;
1235 } 1243 }