From: Jiri Slaby <jslaby@suse.cz>
To: stable@vger.kernel.org
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
Andi Kleen <andi@firstfloor.org>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Jiri Slaby <jslaby@suse.cz>
Subject: [patch added to the 3.12 stable tree] mm: soft-offline: fix num_poisoned_pages counting on concurrent events
Date: Fri, 15 May 2015 16:28:28 +0200 [thread overview]
Message-ID: <1431700109-10261-8-git-send-email-jslaby@suse.cz> (raw)
In-Reply-To: <1431700109-10261-1-git-send-email-jslaby@suse.cz>
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
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>
---
mm/memory-failure.c | 8 ++++----
1 file 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:
--
2.3.7
next prev parent reply other threads:[~2015-05-15 14:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-15 14:28 [patch added to the 3.12 stable tree] ocfs2: dlm: fix race between purge and get lock resource Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] nilfs2: fix sanity check of btree level in nilfs_btree_root_broken() Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] RDMA/CMA: Canonize IPv4 on IPV6 sockets properly Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] gpio: sysfs: fix memory leaks and device hotplug Jiri Slaby
2015-05-15 14:51 ` Johan Hovold
2015-05-15 19:51 ` Jiri Slaby
2015-05-15 20:24 ` Johan Hovold
2015-05-16 6:42 ` Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] mnt: Fix fs_fully_visible to verify the root directory is visible Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] mm/memory-failure: call shake_page() when error hits thp tail page Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] writeback: use |1 instead of +1 to protect against div by zero Jiri Slaby
2015-05-15 14:28 ` Jiri Slaby [this message]
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] xen/console: Update console event channel on resume Jiri Slaby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431700109-10261-8-git-send-email-jslaby@suse.cz \
--to=jslaby@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox