From patchwork Wed Nov 23 22:48:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13054434 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 C3C5AC4332F for ; Wed, 23 Nov 2022 22:48:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 425916B0074; Wed, 23 Nov 2022 17:48:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D5B46B0075; Wed, 23 Nov 2022 17:48:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 29DE26B0078; Wed, 23 Nov 2022 17:48:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1AEC86B0074 for ; Wed, 23 Nov 2022 17:48:37 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id E3764A049F for ; Wed, 23 Nov 2022 22:48:36 +0000 (UTC) X-FDA: 80166197832.10.AEACF58 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 06CD814000B for ; Wed, 23 Nov 2022 22:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669243715; 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=RwK92HT6uXaeNFI0ryIilaUvN1ewEQDVvt+89pcPgvc=; b=Wf+8pB/jqNPR7kw15wkeU3bRsrkKw9ZSEDvFTdY9Jdxp7gINfOHt5R1t57vEjSebhKumC6 EuvNaSoeP6Ulr8TZDy1cWkmd9yQncLuu6lAsLfY0TG+8apGc4YMX0KRhRCabZJtDH4LAd2 kM7gLpy7VWnRDdTbqA1DAd8wigKVato= 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-621-fSIlp9HwOd2_S9Kz1Ymq0w-1; Wed, 23 Nov 2022 17:48:32 -0500 X-MC-Unique: fSIlp9HwOd2_S9Kz1Ymq0w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B9D1A3802B89; Wed, 23 Nov 2022 22:48:30 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6684249BB62; Wed, 23 Nov 2022 22:48:28 +0000 (UTC) Subject: [PATCH v4 0/3] mm, netfs, fscache: Stop read optimisation when folio removed from pagecache From: David Howells To: Linus Torvalds Cc: Ilya Dryomov , Dave Wysochanski , Shyam Prasad N , linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, Dominique Martinet , linux-mm@kvack.org, Rohith Surabattula , v9fs-developer@lists.sourceforge.net, ceph-devel@vger.kernel.org, linux-cachefs@redhat.com, linux-afs@lists.infradead.org, Matthew Wilcox , Steve French , linux-fsdevel@vger.kernel.org, dhowells@redhat.com, Matthew Wilcox , 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-cachefs@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 23 Nov 2022 22:48:25 +0000 Message-ID: <166924370539.1772793.13730698360771821317.stgit@warthog.procyon.org.uk> User-Agent: StGit/1.5 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669243716; a=rsa-sha256; cv=none; b=JwgkHqEzfK31HJBPwx69THfNHZh01NkjhjFow7p60h9+o5LgbWB5iUjBD0K3JGqxyOBVuC Lbd/DsjXC+0FuZz6YUZJL91xOKTqiAzMLKoUmdqBohlG2cFpx/g/2go0bykW9gxaTecL/0 be4tcl1VwReMaQiEV1xqacV2sf/czrE= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Wf+8pB/j"; spf=pass (imf23.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1669243716; 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=RwK92HT6uXaeNFI0ryIilaUvN1ewEQDVvt+89pcPgvc=; b=4xnhdj2s7YRs+b0V1ygjqveKXEz1hoqXQG+yzQcIWNemYUmDhB5uDBTi8hGjNq9/M8ZMk5 MK69a/hs90FNVAa/piyVwGW8gYJySOOSbLTmQ60pV3WafzvUgtxNOEuiuq9VIGYCz3fL+1 X/w9PhzcWgFnPD9t5s74JhlTmcRPWQ4= X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 06CD814000B Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Wf+8pB/j"; spf=pass (imf23.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: X-Stat-Signature: tx9re5mtjoykao48bezd6dfseaw9w1ou X-HE-Tag: 1669243715-271635 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, How about this then? 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. I've also added an additional experimental patch to see if the pair in shrink_folio_list() can be reduced cleanly to just the release call. This involves making filemap_release_folio() have a three-state return. David Changes: ======== 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/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 | 3 +-- mm/migrate.c | 3 +-- mm/truncate.c | 6 ++---- mm/vmscan.c | 34 +++++++++++++++++----------------- 15 files changed, 82 insertions(+), 37 deletions(-)