Commit 7d1900c7 authored by Wanpeng Li's avatar Wanpeng Li Committed by Linus Torvalds

mm/hwpoison: fix failure to split thp w/ refcount held

THP pages will get a refcount in madvise_hwpoison() w/
MF_COUNT_INCREASED flag, however, the refcount is still held when fail
to split THP pages.

Fix it by reducing the refcount of THP pages when fail to split THP.
Signed-off-by: default avatarWanpeng Li <wanpeng.li@hotmail.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5dd2c4bd
...@@ -1725,6 +1725,8 @@ int soft_offline_page(struct page *page, int flags) ...@@ -1725,6 +1725,8 @@ int soft_offline_page(struct page *page, int flags)
if (PageAnon(hpage) && unlikely(split_huge_page(hpage))) { if (PageAnon(hpage) && unlikely(split_huge_page(hpage))) {
pr_info("soft offline: %#lx: failed to split THP\n", pr_info("soft offline: %#lx: failed to split THP\n",
pfn); pfn);
if (flags & MF_COUNT_INCREASED)
put_page(page);
return -EBUSY; return -EBUSY;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment