From: Wanpeng Li Date: Tue, 8 Sep 2015 22:03:10 +0000 (-0700) Subject: mm/hwpoison: fix failure to split thp w/ refcount held X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7d1900c744b2e4687b3e467edf58373c02bcf22d;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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: Wanpeng Li Cc: Naoya Horiguchi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 016c814101ed..8ad923a93539 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1725,6 +1725,8 @@ int soft_offline_page(struct page *page, int flags) if (PageAnon(hpage) && unlikely(split_huge_page(hpage))) { pr_info("soft offline: %#lx: failed to split THP\n", pfn); + if (flags & MF_COUNT_INCREASED) + put_page(page); return -EBUSY; } }