summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>2015-05-05 16:23:46 -0700
committerJiri Slaby <jslaby@suse.cz>2015-05-16 09:12:44 +0200
commit5babf6ec822b6fd79e8941dd3b1c7aa58d8620f6 (patch)
tree894f230e68ad05474b4cb9f62bde708c3876db0e /mm
parent62d7a1a87954f16f6c43d345f347afc2a0ee80ac (diff)
mm: soft-offline: fix num_poisoned_pages counting on concurrent events
commit 602498f9aa43d4951eece3fd6ad95a6d0a78d537 upstream. If multiple soft offline events hit one free page/hugepage concurrently, soft_offline_page() can handle the free page/hugepage multiple times, which makes num_poisoned_pages counter increased more than once. This patch fixes this wrong counting by checking TestSetPageHWPoison for normal papes and by checking the return value of dequeue_hwpoisoned_huge_page() for hugepages. Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Acked-by: Dean Nelson <dnelson@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> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'mm')
-rw-r--r--mm/memory-failure.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 2e94ad1133af..5785b59620ef 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1718,12 +1718,12 @@ int soft_offline_page(struct page *page, int flags)
} else { /* for free pages */
if (PageHuge(page)) {
set_page_hwpoison_huge_page(hpage);
- dequeue_hwpoisoned_huge_page(hpage);
- atomic_long_add(1 << compound_order(hpage),
+ if (!dequeue_hwpoisoned_huge_page(hpage))
+ atomic_long_add(1 << compound_order(hpage),
&num_poisoned_pages);
} else {
- SetPageHWPoison(page);
- atomic_long_inc(&num_poisoned_pages);
+ if (!TestSetPageHWPoison(page))
+ atomic_long_inc(&num_poisoned_pages);
}
}
unset: