aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory-failure.c
diff options
context:
space:
mode:
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>2013-02-22 19:34:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-23 20:50:15 -0500
commit4db0e950c5b78586bea9e1b027be849631f89a17 (patch)
tree5a61c3ebe9274fdd744c59b0d078bb1a18e392b6 /mm/memory-failure.c
parentaf8fae7c08862bb85c5cf445bf9b36314b82111f (diff)
mm/memory-failure.c: fix wrong num_poisoned_pages in handling memory 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). [akpm@linux-foundation.org: tweak comment] Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Tony Luck <tony.luck@intel.com> Cc: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory-failure.c')
-rw-r--r--mm/memory-failure.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 9cab165fd668..1a56d63adf9c 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1039,7 +1039,17 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
1039 return 0; 1039 return 0;
1040 } 1040 }
1041 1041
1042 nr_pages = 1 << compound_trans_order(hpage); 1042 /*
1043 * Currently errors on hugetlbfs pages are measured in hugepage units,
1044 * so nr_pages should be 1 << compound_order. OTOH when errors are on
1045 * transparent hugepages, they are supposed to be split and error
1046 * measurement is done in normal page units. So nr_pages should be one
1047 * in this case.
1048 */
1049 if (PageHuge(p))
1050 nr_pages = 1 << compound_order(hpage);
1051 else /* normal page or thp */
1052 nr_pages = 1;
1043 atomic_long_add(nr_pages, &num_poisoned_pages); 1053 atomic_long_add(nr_pages, &num_poisoned_pages);
1044 1054
1045 /* 1055 /*