Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356618
b: refs/heads/master
c: 524fca1
h: refs/heads/master
v: v3
  • Loading branch information
Naoya Horiguchi authored and Linus Torvalds committed Feb 24, 2013
1 parent 27ef5b0 commit 3f0310c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 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: 6d04399040ca9058c12c766bbbefbf6acdb2eabe
refs/heads/master: 524fca1e7356f8f9f92c51ca52727187872fc5f5
27 changes: 22 additions & 5 deletions trunk/mm/memory-failure.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
struct page *hpage;
int res;
unsigned int nr_pages;
unsigned long page_flags;

if (!sysctl_memory_failure_recovery)
panic("Memory failure from trap %d on page %lx", trapno, pfn);
Expand Down Expand Up @@ -1128,6 +1129,15 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
*/
lock_page(hpage);

/*
* We use page flags to determine what action should be taken, but
* the flags can be modified by the error containment action. One
* example is an mlocked page, where PG_mlocked is cleared by
* page_remove_rmap() in try_to_unmap_one(). So to determine page status
* correctly, we save a copy of the page flags at this time.
*/
page_flags = p->flags;

/*
* unpoison always clear PG_hwpoison inside page lock
*/
Expand Down Expand Up @@ -1186,12 +1196,19 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
}

res = -EBUSY;
for (ps = error_states;; ps++) {
if ((p->flags & ps->mask) == ps->res) {
res = page_action(ps, p, pfn);
/*
* The first check uses the current page flags which may not have any
* relevant information. The second check with the saved page flagss is
* carried out only if the first check can't determine the page status.
*/
for (ps = error_states;; ps++)
if ((p->flags & ps->mask) == ps->res)
break;
}
}
if (!ps->mask)
for (ps = error_states;; ps++)
if ((page_flags & ps->mask) == ps->res)
break;
res = page_action(ps, p, pfn);
out:
unlock_page(hpage);
return res;
Expand Down

0 comments on commit 3f0310c

Please sign in to comment.