Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp3272ybs; Sat, 23 May 2020 18:54:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfYmn3y6ZHDTKY+gwz1fL9GUEe5a2RjX5d/GJv3LRdEdIBxSVAMGONcpfHQy0kAoj9IkDP X-Received: by 2002:a17:906:4eda:: with SMTP id i26mr14295253ejv.228.1590285288044; Sat, 23 May 2020 18:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590285288; cv=none; d=google.com; s=arc-20160816; b=EdPDAkMqK624qNe1SNh7a861Y+n1KjBCOsL513moAp7c7SOWyrVAmHe5ScGLFdNQdy RmfxZdV8fds210W5iZ3uDmVICzIiv7T1ajf4llWxiX/1ruPfWhVgqB5/04dgQCcRXtSK wqaep4HmzC1Z73ReqWnb27ueDNdZlYOvoJQFqVWZJcpc02h4S5hiuHxIk6W9+H8LyAiz VzoUbumkDsJ7VHH4uHPfNnGu5pkxsNnOSwLvONYd+VXOmFZqeuluwfuq0bEGPsCYcCj/ 3O+sIt9Lw/63SmL+7uGA6KGgdeC4d/kSia53DvEq5MNyuPsviSCencP0h4LWQUCSiPbE pNEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :subject:cc:to:from:date:dkim-signature; bh=GTGkis+uD2ofy0cZ775LPyRGKOg7EagKw1kot4jTVqU=; b=X/uI6c0Zn+bqHAHT2hzBrWDCfc9DUkdQJGyQcJ/WTAm062icvHrcyFclGOU4yVYi81 eXvOipmogVlRfxs5ER5ozCKlzWjf8rOLOaw6AXPDznVM/vvLFw4/Nd7gPJbSMuDEZML0 f2udFvtIx67WD+XVFlawRZOjVPt9EhdGCgIIjEN8HtNFXSC2VrKCcnr9OEbTMJHuzrb3 Fbb0Qv+629ybEufyjXvO6gKcugTq03qAp0yuiNpZ0BKXxHZXxxIAFg4JL42DOoyS2Er8 Hi/Q0gjT4qca9mw7wEg5TJZhTYo6FK9DbH5sukZbP208MYM4VepCmTt+mhkpPLK08pDx zAtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YXCe6XV0; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si6784707edw.590.2020.05.23.18.54.25; Sat, 23 May 2020 18:54:48 -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=@google.com header.s=20161025 header.b=YXCe6XV0; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388291AbgEXBud (ORCPT + 99 others); Sat, 23 May 2020 21:50:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387589AbgEXBuc (ORCPT ); Sat, 23 May 2020 21:50:32 -0400 Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7B34C061A0E for ; Sat, 23 May 2020 18:50:32 -0700 (PDT) Received: by mail-oi1-x244.google.com with SMTP id l6so12831823oic.9 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=tUeu+bBzCdMQY6XNzakEyFPIrLUA9VIyb1Og07Z6d59DLq6taxMwFESmAHNzUDzyMu nFnKRvD3yxVNdBcGTiE8U/VXllLIAyZbpWj3SRtWeA7+4VA00tGVjN4r04JB7ZIl0ZLo 65yoWp+r9M0T8CtLEKO0t7bZwZ4BaJDl+wswEa7q0+LCKeA4u9UIB/LzU+bbPYuLyG8E BCKuCbMDTHvohd3I7XuqiWhNgLmX5WVymyMgEaxKbV4sOFs0i547ij3ayRXXqGssbuQm BNv2OXUP+iozQinqaltewhLIgKYNE2ws7bzEz65XWCPUvVnkV1DLSaBx6zvQy25ovQKE XDKQ== X-Gm-Message-State: AOAM532nNMVlP/rZ+Wc7vvfq4Lw9bmcOx7wsxyYjyQk204JoOaaX9TR0 mhJWmWdi0Qbt8a/VT6Y0ebNveQ== 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 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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+ --- 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; }