From: Hugh Dickins Date: Thu, 28 May 2020 05:20:43 +0000 (-0700) Subject: mm,thp: stop leaking unreleased file pages X-Git-Tag: v5.4.44~43 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a7ba9f24737b4a994ef1be557aeb6544e415f39d;p=platform%2Fkernel%2Flinux-rpi.git mm,thp: stop leaking unreleased file pages [ Upstream commit 2f33a706027c94cd4f70fcd3e3f4a17c1ce4ea4b ] When collapse_file() calls try_to_release_page(), it has already isolated the page: so if releasing buffers happens to fail (as it sometimes does), remember to putback_lru_page(): otherwise that page is left unreclaimable and unfreeable, and the file extent uncollapsible. Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS") Signed-off-by: Hugh Dickins Signed-off-by: Andrew Morton Acked-by: Song Liu Acked-by: Kirill A. Shutemov Acked-by: Johannes Weiner Cc: Rik van Riel Cc: [5.4+] Link: http://lkml.kernel.org/r/alpine.LSU.2.11.2005231837500.1766@eggly.anvils Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- diff --git a/mm/khugepaged.c b/mm/khugepaged.c index a8a57be..f765475 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1655,6 +1655,7 @@ static void collapse_file(struct mm_struct *mm, if (page_has_private(page) && !try_to_release_page(page, GFP_KERNEL)) { result = SCAN_PAGE_HAS_PRIVATE; + putback_lru_page(page); goto out_unlock; }