From: Yongkai Wu <nic.wuyk@gmail.com>
To: n-horiguchi@ah.jp.nec.com
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH] mm/hwpoison: fix incorrect call put_hwpoison_page() when isolate_huge_page() return false
Date: Tue, 13 Nov 2018 15:00:09 +0800 [thread overview]
Message-ID: <CAJtqMcZVQFp8U0aFqrMDD2-UGuLkWYvg3rytcCswnOT_ZMSzjQ@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]
when isolate_huge_page() return false,it won't takes a refcount of page,
if we call put_hwpoison_page() in that case,we may hit the VM_BUG_ON_PAGE!
Signed-off-by: Yongkai Wu <nic_w@163.com>
---
mm/memory-failure.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 0cd3de3..ed09f56 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1699,12 +1699,13 @@ static int soft_offline_huge_page(struct page
*page, int flags)
unlock_page(hpage);
ret = isolate_huge_page(hpage, &pagelist);
- /*
- * get_any_page() and isolate_huge_page() takes a refcount each,
- * so need to drop one here.
- */
- put_hwpoison_page(hpage);
- if (!ret) {
+ if (ret) {
+ /*
+ * get_any_page() and isolate_huge_page() takes a refcount each,
+ * so need to drop one here.
+ */
+ put_hwpoison_page(hpage);
+ } else {
pr_info("soft offline: %#lx hugepage failed to isolate\n", pfn);
return -EBUSY;
}
--
1.8.3.1
[-- Attachment #2: Type: text/html, Size: 2172 bytes --]
next reply other threads:[~2018-11-13 7:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-13 7:00 Yongkai Wu [this message]
2018-11-13 7:46 ` Naoya Horiguchi
2018-11-13 9:13 ` Yongkai Wu
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=CAJtqMcZVQFp8U0aFqrMDD2-UGuLkWYvg3rytcCswnOT_ZMSzjQ@mail.gmail.com \
--to=nic.wuyk@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=n-horiguchi@ah.jp.nec.com \
/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