Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177617
b: refs/heads/master
c: 1668bfd
h: refs/heads/master
i:
  177615: abed373
v: v3
  • Loading branch information
Wu Fengguang authored and Andi Kleen committed Dec 16, 2009
1 parent 9c03676 commit 3f105b0
Show file tree
Hide file tree
Showing 2 changed files with 16 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: 82ba011b9041dd31c15e4f63797b08aa0a288e61
refs/heads/master: 1668bfd5be9d8a52536c4865000fbbe065a3613b
20 changes: 15 additions & 5 deletions trunk/mm/memory-failure.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ static int page_action(struct page_state *ps, struct page *p,
* Do all that is necessary to remove user space mappings. Unmap
* the pages and send SIGBUS to the processes if the data was dirty.
*/
static void hwpoison_user_mappings(struct page *p, unsigned long pfn,
static int hwpoison_user_mappings(struct page *p, unsigned long pfn,
int trapno)
{
enum ttu_flags ttu = TTU_UNMAP | TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS;
Expand All @@ -665,15 +665,18 @@ static void hwpoison_user_mappings(struct page *p, unsigned long pfn,
int i;
int kill = 1;

if (PageReserved(p) || PageCompound(p) || PageSlab(p) || PageKsm(p))
return;
if (PageReserved(p) || PageSlab(p))
return SWAP_SUCCESS;

/*
* This check implies we don't kill processes if their pages
* are in the swap cache early. Those are always late kills.
*/
if (!page_mapped(p))
return;
return SWAP_SUCCESS;

if (PageCompound(p) || PageKsm(p))
return SWAP_FAIL;

if (PageSwapCache(p)) {
printk(KERN_ERR
Expand Down Expand Up @@ -735,6 +738,8 @@ static void hwpoison_user_mappings(struct page *p, unsigned long pfn,
*/
kill_procs_ao(&tokill, !!PageDirty(p), trapno,
ret != SWAP_SUCCESS, pfn);

return ret;
}

int __memory_failure(unsigned long pfn, int trapno, int flags)
Expand Down Expand Up @@ -807,8 +812,13 @@ int __memory_failure(unsigned long pfn, int trapno, int flags)

/*
* Now take care of user space mappings.
* Abort on fail: __remove_from_page_cache() assumes unmapped page.
*/
hwpoison_user_mappings(p, pfn, trapno);
if (hwpoison_user_mappings(p, pfn, trapno) != SWAP_SUCCESS) {
printk(KERN_ERR "MCE %#lx: cannot unmap page, give up\n", pfn);
res = -EBUSY;
goto out;
}

/*
* Torn down by someone else?
Expand Down

0 comments on commit 3f105b0

Please sign in to comment.