Skip to content

Commit

Permalink
mm/memory-failure.c: fix wrong num_poisoned_pages in handling memory …
Browse files Browse the repository at this point in the history
…error on thp

num_poisoned_pages counts up the number of pages isolated by memory
errors.  But for thp, only one subpage is isolated because memory error
handler splits it, so it's wrong to add (1 << compound_trans_order).

[[email protected]: tweak comment]
Signed-off-by: Naoya Horiguchi <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Wu Fengguang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Naoya Horiguchi authored and torvalds committed Feb 24, 2013
1 parent af8fae7 commit 4db0e95
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mm/memory-failure.c
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,17 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
return 0;
}

nr_pages = 1 << compound_trans_order(hpage);
/*
* Currently errors on hugetlbfs pages are measured in hugepage units,
* so nr_pages should be 1 << compound_order. OTOH when errors are on
* transparent hugepages, they are supposed to be split and error
* measurement is done in normal page units. So nr_pages should be one
* in this case.
*/
if (PageHuge(p))
nr_pages = 1 << compound_order(hpage);
else /* normal page or thp */
nr_pages = 1;
atomic_long_add(nr_pages, &num_poisoned_pages);

/*
Expand Down

0 comments on commit 4db0e95

Please sign in to comment.