Linux-mm Archive on lore.kernel.org
 help / color / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Song Liu <songliubraving@fb.com>,
	 "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	 linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH] mm,thp: stop leaking unreleased file pages
Date: Sat, 23 May 2020 18:50:15 -0700 (PDT)
Message-ID: <alpine.LSU.2.11.2005231837500.1766@eggly.anvils> (raw)

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.

Signed-off-by: Hugh Dickins <hughd@google.com>
Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS")
Cc: stable@vger.kernel.org # v5.4+
---

 mm/khugepaged.c |    1 +
 1 file changed, 1 insertion(+)

--- 5.7-rc6/mm/khugepaged.c	2020-04-12 16:24:37.710999073 -0700
+++ linux/mm/khugepaged.c	2020-05-10 17:06:21.788398646 -0700
@@ -1692,6 +1692,7 @@ static void collapse_file(struct mm_stru
 		if (page_has_private(page) &&
 		    !try_to_release_page(page, GFP_KERNEL)) {
 			result = SCAN_PAGE_HAS_PRIVATE;
+			putback_lru_page(page);
 			goto out_unlock;
 		}
 


             reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-24  1:50 Hugh Dickins [this message]
2020-05-25  0:05 ` Song Liu
2020-05-25  4:32 ` Kirill A. Shutemov
2020-05-26 16:01 ` Johannes Weiner
2020-05-27 21:28   ` Hugh Dickins
2020-05-28  8:51     ` Naresh Kamboju

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=alpine.LSU.2.11.2005231837500.1766@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=songliubraving@fb.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

Linux-mm Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mm/0 linux-mm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mm linux-mm/ https://lore.kernel.org/linux-mm \
		linux-mm@kvack.org
	public-inbox-index linux-mm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kvack.linux-mm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git