aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJin Dongming <jin.dongming@np.css.fujitsu.com>2011-02-01 18:52:41 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-02-02 19:03:19 -0500
commitaf241a083404acda7ba3690e5b7697949d729fcc (patch)
treef299ac844b38bc9a82e1477d8ef16648898f5584
parenta6d30dddae4648837be5a0c0cb2c0ae9ad0377db (diff)
thp: fix unsuitable behavior for hwpoisoned tail page
When a tail page of THP is poisoned, memory-failure will do nothing except setting PG_hwpoison, while the expected behavior is that the process, who is using the poisoned tail page, should be killed. The above problem is caused by lru check of the poisoned tail page of THP. Because PG_lru flag is only set on the head page of THP, the check always consider the poisoned tail page as NON lru page. So the lru check for the tail page of THP should be avoided, as like as hugetlb. This patch adds !PageTransCompound() before lru check for THP, because of the check (!PageHuge() && !PageTransCompound()) the whole branch could be optimized away at build time when both hugetlbfs and THP are set with "N" (or in archs not supporting either of those). [akpm@linux-foundation.org: fix unrelated typo in shake_page() comment] Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com> Reviewed-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/memory-failure.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 04158d6f44d4..0207c2f6f8bd 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -233,8 +233,8 @@ void shake_page(struct page *p, int access)
233 } 233 }
234 234
235 /* 235 /*
236 * Only all shrink_slab here (which would also 236 * Only call shrink_slab here (which would also shrink other caches) if
237 * shrink other caches) if access is not potentially fatal. 237 * access is not potentially fatal.
238 */ 238 */
239 if (access) { 239 if (access) {
240 int nr; 240 int nr;
@@ -1065,19 +1065,22 @@ int __memory_failure(unsigned long pfn, int trapno, int flags)
1065 * The check (unnecessarily) ignores LRU pages being isolated and 1065 * The check (unnecessarily) ignores LRU pages being isolated and
1066 * walked by the page reclaim code, however that's not a big loss. 1066 * walked by the page reclaim code, however that's not a big loss.
1067 */ 1067 */
1068 if (!PageLRU(p) && !PageHuge(p)) 1068 if (!PageHuge(p) && !PageTransCompound(p)) {
1069 shake_page(p, 0); 1069 if (!PageLRU(p))
1070 if (!PageLRU(p) && !PageHuge(p)) { 1070 shake_page(p, 0);
1071 /* 1071 if (!PageLRU(p)) {
1072 * shake_page could have turned it free. 1072 /*
1073 */ 1073 * shake_page could have turned it free.
1074 if (is_free_buddy_page(p)) { 1074 */
1075 action_result(pfn, "free buddy, 2nd try", DELAYED); 1075 if (is_free_buddy_page(p)) {
1076 return 0; 1076 action_result(pfn, "free buddy, 2nd try",
1077 DELAYED);
1078 return 0;
1079 }
1080 action_result(pfn, "non LRU", IGNORED);
1081 put_page(p);
1082 return -EBUSY;
1077 } 1083 }
1078 action_result(pfn, "non LRU", IGNORED);
1079 put_page(p);
1080 return -EBUSY;
1081 } 1084 }
1082 1085
1083 /* 1086 /*