From patchwork Thu Dec 22 15:01:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13080065 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C31C1C4332F for ; Thu, 22 Dec 2022 15:02:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6025A940007; Thu, 22 Dec 2022 10:02:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B285900002; Thu, 22 Dec 2022 10:02:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4533E940007; Thu, 22 Dec 2022 10:02:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 36DE8900002 for ; Thu, 22 Dec 2022 10:02:10 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id F0F7780E55 for ; Thu, 22 Dec 2022 15:02:09 +0000 (UTC) X-FDA: 80270257578.27.7C34C8F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf30.hostedemail.com (Postfix) with ESMTP id 1EAE8800A6 for ; Thu, 22 Dec 2022 15:02:02 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=M3IqyvZS; spf=pass (imf30.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1671721323; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=LJ9TKjkNcbwIl+mphZW6iF9b6MFhoECdv27WBprwBlw=; b=reHV2lwWChLfnxUUJKAaSI7r84bRQzFkt8G3woe8vCxSjlqguQbwviaWzHSGgwzrkph7lD 7a0M5VeTIWb73rb5yvv3Q8sv9SiBwNdXk1JS7FWhkF2ilS6J33AndWt9kYAhAJ6pKdwocs I2IUdO8/tr6Ylq1edjn6kEH+hyv3IhQ= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=M3IqyvZS; spf=pass (imf30.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1671721323; a=rsa-sha256; cv=none; b=GM1Srs879FDduWH6RSgi7kWko19gY4UITDVT6R8tvoiCah/La0XZtqUd4voPOT5gmf2czD sA7I4pZ1yFiB7FntZ57dsBPLBpgvASU8hwx+JWtsE6/lVcWI7tgZs4y3tc/k9CGFcWKFa7 57AoGYtcqIH+ds+ym17i0cIgEYARTC4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671721322; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LJ9TKjkNcbwIl+mphZW6iF9b6MFhoECdv27WBprwBlw=; b=M3IqyvZS3yKdWhlO6ebxH0gqP68j7MYUxxykryNVppYvhqVR7uy/m2Pw0Gwk5G2k3SUgtq hPpN558NrjHRhcqvMmHuligeXbrZlJLR2YYcz1hChNX5V07J68e5Lbng6DTlMkxdhf09Nc CDujoVszFRsDGbP1PYxtDhL895K2qYY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-546-vEDcC2HANCu8HRye7N1l7Q-1; Thu, 22 Dec 2022 10:01:59 -0500 X-MC-Unique: vEDcC2HANCu8HRye7N1l7Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C0CF1C06901; Thu, 22 Dec 2022 15:01:57 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 844512166B29; Thu, 22 Dec 2022 15:01:54 +0000 (UTC) Subject: [PATCH v5 0/3] mm, netfs, fscache: Stop read optimisation when folio removed from pagecache From: David Howells To: Matthew Wilcox Cc: Linus Torvalds , linux-afs@lists.infradead.org, ceph-devel@vger.kernel.org, Steve French , Shyam Prasad N , Dave Wysochanski , Dominique Martinet , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, Rohith Surabattula , linux-cachefs@redhat.com, Andreas Dilger , linux-nfs@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-mm@kvack.org, Theodore Ts'o , Ilya Dryomov , linux-cifs@vger.kernel.org, dhowells@redhat.com, Linus Torvalds , Jeff Layton , linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-erofs@lists.ozlabs.org, linux-ext4@lists.ozlabs.org, linux-cachefs@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 22 Dec 2022 15:01:53 +0000 Message-ID: <167172131368.2334525.8569808925687731937.stgit@warthog.procyon.org.uk> User-Agent: StGit/1.5 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 1EAE8800A6 X-Stat-Signature: ashb9jxkj3jq6cytzeci3wyfkcf7qndk X-HE-Tag: 1671721322-971474 X-HE-Meta: U2FsdGVkX18SSaHH9fC8EGMXfwHRxCNIhe/zjtKtScsw8E3ioHI6h4dv8j6hsTf6ddTRx8SqJ6WvY/x+AbCjIzg2omfWKHSqCzzNm882T1glVJpqbZZKRHZkSDDLg1nhTVb1Z3Fowhq5D6gDtZfRglaGwqMNYjkMMNohmUWwlZoJQir8GE6pC0Z/BSceDCTPkPVj6b/RRglJtW/ypPZvgbj1zGdn5TouzkUdRZ69lau/5No1WHEz1/x0nU5a65PKhVn78FblAmjB0oc+N3XwVmfJSxWWP//5oWC54riB97Nd+rTff9PQyD6aWPgokZZX5Gbq+Mrmbkh0bBz35Ufke8lVcqBF0EyIP+rwEEAnZDhakvzsyNjkps96QK/KkD7Ahsntl1RypmYHqi0c64Xii6sOfUh5kea42DxYZ3QdBCqRUPsQDRSExaNt3wv+962bepwQN2tDbXdJ61p+OKrdBjg0uXleLb10T4VELJ91GeutSRNMZFKprzTiHENYqFEPUxIBgmfzvVzaTOXqqi7DuWAtPOrewXuZ0RgTF3tIcAmQQ+brQpF8bA/eC40LrpnsFfZGWcyn3/1u+K+Tm6j65XqeYLRNVh4YdSN+EU1zNP8eOdN00a4QOQMFeFkAzv00QH6063lh2aa7R9YuWMBWoZlNQOtX0Rc4D6fdRZuA33JjDsQs0aKrIN5iZ5JgFhm18FzQSDHku1k5ao+2E7L4i4F9ojYi+9vgPUwadmUqQAAv6+agxsPCkD2FQsTUpev8TlY4BqIVC0oa+s61JIm6YX93k73F9Wha85ynw9i7B0FGU/7hsTldGIsaocHuyMJjcWgiuJVv/l99rC76yGC6PBY2xyXeGuRn/ro2j2ZPbjswmxDO/L8zGCcBzgF+hzX0sDuvTslAuH3MJk4slGjn1CQEDBVUQ9aO 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: Hi Linus, I've split the folio_has_private()/filemap_release_folio() call pair merging into its own patch, separate from the actual bugfix and pulled out the folio_needs_release() function into mm/internal.h and made filemap_release_folio() use it. I've also got rid of the bit clearances from the network filesystem evict_inode functions as they doesn't seem to be necessary. Note that the last vestiges of try_to_release_page() got swept away in the current merge window, so I rebased and dealt with that. One comment remained, which is removed by the first patch. David Changes: ======== ver #5) - Rebased on linus/master. try_to_release_page() has now been entirely replaced by filemap_release_folio(), barring one comment. - Cleaned up some pairs in ext4. ver #4) - Split has_private/release call pairs into own patch. - Moved folio_needs_release() to mm/internal.h and removed open-coded version from filemap_release_folio(). - Don't need to clear AS_RELEASE_ALWAYS in ->evict_inode(). - Added experimental patch to reduce shrink_folio_list(). ver #3) - Fixed mapping_clear_release_always() to use clear_bit() not set_bit(). - Moved a '&&' to the correct line. ver #2) - Rewrote entirely according to Willy's suggestion[1]. Link: https://lore.kernel.org/r/Yk9V/03wgdYi65Lb@casper.infradead.org/ [1] Link: https://lore.kernel.org/r/164928630577.457102.8519251179327601178.stgit@warthog.procyon.org.uk/ # v1 Link: https://lore.kernel.org/r/166844174069.1124521.10890506360974169994.stgit@warthog.procyon.org.uk/ # v2 Link: https://lore.kernel.org/r/166869495238.3720468.4878151409085146764.stgit@warthog.procyon.org.uk/ # v3 Link: https://lore.kernel.org/r/1459152.1669208550@warthog.procyon.org.uk/ # v3 also --- David Howells (3): mm: Merge folio_has_private()/filemap_release_folio() call pairs mm, netfs, fscache: Stop read optimisation when folio removed from pagecache mm: Make filemap_release_folio() better inform shrink_folio_list() fs/9p/cache.c | 2 ++ fs/afs/internal.h | 2 ++ fs/cachefiles/namei.c | 2 ++ fs/ceph/cache.c | 2 ++ fs/cifs/fscache.c | 2 ++ fs/ext4/move_extent.c | 12 ++++-------- fs/splice.c | 3 +-- include/linux/pagemap.h | 23 ++++++++++++++++++++++- mm/filemap.c | 20 +++++++++++++++----- mm/huge_memory.c | 3 +-- mm/internal.h | 11 +++++++++++ mm/khugepaged.c | 3 +-- mm/memory-failure.c | 8 +++----- mm/migrate.c | 3 +-- mm/truncate.c | 6 ++---- mm/vmscan.c | 35 ++++++++++++++++++----------------- 16 files changed, 89 insertions(+), 48 deletions(-)