From patchwork Sun May 24 01:50:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 11567093 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A14531391 for ; Sun, 24 May 2020 01:50:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 63E972085B for ; Sun, 24 May 2020 01:50:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YXCe6XV0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 63E972085B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8741580008; Sat, 23 May 2020 21:50:33 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 824E380007; Sat, 23 May 2020 21:50:33 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7131780008; Sat, 23 May 2020 21:50:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0032.hostedemail.com [216.40.44.32]) by kanga.kvack.org (Postfix) with ESMTP id 56C6A80007 for ; Sat, 23 May 2020 21:50:33 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 0C97449960F for ; Sun, 24 May 2020 01:50:33 +0000 (UTC) X-FDA: 76849933146.03.fuel16_4c3521243239 X-Spam-Summary: 2,0,0,e8196b56fb30a3ac,d41d8cd98f00b204,hughd@google.com,,RULES_HIT:41:355:379:800:960:966:973:988:989:1260:1277:1313:1314:1345:1437:1516:1518:1534:1540:1593:1594:1711:1714:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3152:3350:3865:3867:3868:3871:3872:3874:4250:4321:4385:5007:6119:6261:6653:10004:10400:10450:10455:11026:11473:11658:11914:12296:12297:12438:12517:12519:12555:12679:12740:12895:12986:13069:13311:13357:13439:14096:14097:14181:14394:14659:14721:19904:19999:21080:21444:21451:21627:21972:21987:30054,0,RBL:209.85.167.193:@google.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: fuel16_4c3521243239 X-Filterd-Recvd-Size: 3746 Received: from mail-oi1-f193.google.com (mail-oi1-f193.google.com [209.85.167.193]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Sun, 24 May 2020 01:50:32 +0000 (UTC) Received: by mail-oi1-f193.google.com with SMTP id o24so12884393oic.0 for ; Sat, 23 May 2020 18:50:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:user-agent:mime-version; bh=GTGkis+uD2ofy0cZ775LPyRGKOg7EagKw1kot4jTVqU=; b=YXCe6XV0Tu1cYSY+GV19pQoXKE1HdBmMQCMd/UTuxnG6GT7aD5TFD8TPv9jUndpR99 +c+k73mOQOYzHJtewAQj2N07pQB7MX+FMAFCd9HtxFCSAjWStW5+zRqBDSZLnOZdNfFb PdOqMpV57kzRZixu6yTIK1RaJIb5NYxb1BKkM2HLIAk7KuLB/AM96znCr+O/ihS2YiS3 mf5dN7m5I01Ixu92CEls4QCSlE7r5WGpSSyz4avJIHkFvjoX/tAdu0A8mLR7bfLMPJfn JfJgc90iBH3nSoZV/Xv/OVabK1ODNh21wE1vRllEsnPXIr5iKKmqJwFh6sU2XhFNLMmu aBfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:user-agent :mime-version; bh=GTGkis+uD2ofy0cZ775LPyRGKOg7EagKw1kot4jTVqU=; b=npsCB2KdDgTwmh+vNxBZTZJftxIb8TAHPQfbrBF90OYQoIkHHcC4Hhe8CSA1OnRMa+ MrsqOovIDuj79yKqx+uCVZ9FTI735/F+lyOkNgIhIuF3jinFHYywA9rf3s3xY6KnQq5Q GuISlQASYHNL3A7PmBnFhUOBkJBc9BaUifUhOJX3Yuvb3XzIligBeNiddPrhF+xiMynq c/b2a7wBl12tmywE9kiTCKdlLsuMh4UJCTqfqlaJQeGMcnWwjqFXbjr/iHV7W5ker6mi OUWkQhI52D2qMQ0vEdk4WHV2RxAgDdkC07JAzKA1b8rj1P+GDuv0xKKE4k2k2VCeP4xw dqKg== X-Gm-Message-State: AOAM5339SfrikzvekXCCkzZmsVtM8CzU4HyVF325Kv8mVzX2ln39p8AZ OJnaCmlWm18GjWU7wQf8ewGOjg== X-Google-Smtp-Source: ABdhPJxaHuIb6ZWnBsergKfmo1QTtSLghg3lk2e4mQ4KOB2hMGfsuCM6lg7KfN51p0oEGAZEhcZdWw== X-Received: by 2002:aca:4852:: with SMTP id v79mr7088402oia.20.1590285031681; Sat, 23 May 2020 18:50:31 -0700 (PDT) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id h9sm3856461oor.21.2020.05.23.18.50.29 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Sat, 23 May 2020 18:50:30 -0700 (PDT) Date: Sat, 23 May 2020 18:50:15 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Andrew Morton cc: Song Liu , "Kirill A. Shutemov" , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH] mm,thp: stop leaking unreleased file pages Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS") Cc: stable@vger.kernel.org # v5.4+ Acked-by: Song Liu Acked-by: Kirill A. Shutemov Acked-by: Johannes Weiner --- 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; }