Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp668555ybg; Mon, 1 Jun 2020 11:13:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvxyC6PKrVdrntTzkWhkUfbWndT2R60eXtmAo/fDPe3L1X1CnkHSUHF6X1+V8D0NEyWFkd X-Received: by 2002:a17:906:3ed3:: with SMTP id d19mr21580804ejj.404.1591035182488; Mon, 01 Jun 2020 11:13:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591035182; cv=none; d=google.com; s=arc-20160816; b=qQ3fuBszrO8SrR0vAYfCRp6HAIUL2/VBvw0EUQdqedB321I2lMG1++VjgsDV8QNoM/ bBpF5d2lj6NspAdWHIDgQvmIF6d6cbH0LHhTVvbPTYkw6Ncln5dPbsp41X7THzmEqNq0 hhETsVPFl4D9Np92953lVxMTz6xVhDB4fqvtfrXIl9YU49q461r/txby7AUSmb2hUHie le6RKjCOhykfaJHQC26rRTsPimNJB75wKAMVbqYjs2RCuTXb4A2YapMWVa3LBNEUTOYc FnI2jA+DkknMjZnxz1I/OmEl10+Yhv88OI38U4F4XN353CMdKI0cjlRduuGhEk3FXmDK jydQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bOJHwcwTZTQAE04SsG7krGq8h73BPtjnOjhtKWdgkx0=; b=jqUcstsw4UmgCrQmAjNzZXdp70cTyuXrlktZLOsAyLLcScllZ89Tx3IE/RMvXYdC/b qDV5S8QGeYylFx887AnK65Q3/tDuhDL/coYFqWcUE1GcqdS2VqJqavZs38bnhcK7WeAf EcBwebxb1REw81taLAwoNnp2cN8D8XkWVRZdjIvs60X6QqSjwfJevDM7NgQ+/4j+/c8H N9C/2WAT1gFJmuW5ukt4g0nZx/YlUY4bE8Ab4X0OZcjDNMmprlLobxgWkSAYd3M4J4sf LR4UWhLN8yh7XdXwYIEpYgzBZ4YGY9xG9CjcBzLnPlLmJgv3JQ8R1XeTjGd8B1FKTsn5 PwVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TwWOcJVr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si94845edt.176.2020.06.01.11.12.39; Mon, 01 Jun 2020 11:13:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TwWOcJVr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730934AbgFASJv (ORCPT + 99 others); Mon, 1 Jun 2020 14:09:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:56260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730916AbgFASJr (ORCPT ); Mon, 1 Jun 2020 14:09:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CC5B82068D; Mon, 1 Jun 2020 18:09:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591034986; bh=c2cjYBWGsu5UJhKoBZ+DStvS3FpJlGb52/gEQaie32Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TwWOcJVrvmqc4AK4HZZNhTNJnfv5cTosxZFdIjr/mjIW8CLO3m8NlxQ4PSMPfqMNQ J/G02CMEMoTCBK8iBBCCgnLHJGrw77BY9SC01kMpRgxCcTruk5bU+LFRFfqeBklrAw XUmGyvo+iPH2/Ue51UZXRkueuD/XyqYC5Z96O6rM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hugh Dickins , Andrew Morton , Song Liu , "Kirill A. Shutemov" , Johannes Weiner , Rik van Riel , Linus Torvalds , Sasha Levin Subject: [PATCH 5.4 099/142] mm,thp: stop leaking unreleased file pages Date: Mon, 1 Jun 2020 19:54:17 +0200 Message-Id: <20200601174048.229621580@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601174037.904070960@linuxfoundation.org> References: <20200601174037.904070960@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hugh Dickins [ 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 --- mm/khugepaged.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index a8a57bebb5fa..f765475be359 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; } -- 2.25.1