Skip to content

Commit

Permalink
mm/hwpoison: fix the lack of one reference count against poisoned page
Browse files Browse the repository at this point in the history
The lack of one reference count against poisoned page for hwpoison_inject
w/o hwpoison_filter enabled result in hwpoison detect -1 users still
referenced the page, however, the number should be 0 except the poison
handler held one after successfully unmap.  This patch fix it by hold one
referenced count against poisoned page for hwpoison_inject w/ and w/o
hwpoison_filter enabled.

Before patch:

[   71.902112] Injecting memory failure at pfn 224706
[   71.902137] MCE 0x224706: dirty LRU page recovery: Failed
[   71.902138] MCE 0x224706: dirty LRU page still referenced by -1 users

After patch:

[   94.710860] Injecting memory failure at pfn 215b68
[   94.710885] MCE 0x215b68: dirty LRU page recovery: Recovered

Reviewed-by: Naoya Horiguchi <[email protected]>
Acked-by: Andi Kleen <[email protected]>
Signed-off-by: Wanpeng Li <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Wanpeng Li authored and torvalds committed Sep 30, 2013
1 parent 2d421ac commit fb31ba3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mm/hwpoison-inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ static int hwpoison_inject(void *data, u64 val)
if (!capable(CAP_SYS_ADMIN))
return -EPERM;

if (!hwpoison_filter_enable)
goto inject;
if (!pfn_valid(pfn))
return -ENXIO;

Expand All @@ -33,6 +31,9 @@ static int hwpoison_inject(void *data, u64 val)
if (!get_page_unless_zero(hpage))
return 0;

if (!hwpoison_filter_enable)
goto inject;

if (!PageLRU(p) && !PageHuge(p))
shake_page(p, 0);
/*
Expand Down

0 comments on commit fb31ba3

Please sign in to comment.