From mboxrd@z Thu Jan 1 00:00:00 1970 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 86A09C433F5 for ; Thu, 7 Apr 2022 06:42:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DAA096B0071; Thu, 7 Apr 2022 02:42:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D592F6B0073; Thu, 7 Apr 2022 02:42:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C20F06B0074; Thu, 7 Apr 2022 02:42:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0107.hostedemail.com [216.40.44.107]) by kanga.kvack.org (Postfix) with ESMTP id B2A826B0071 for ; Thu, 7 Apr 2022 02:42:13 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 76FFB8E56A for ; Thu, 7 Apr 2022 06:42:03 +0000 (UTC) X-FDA: 79329138126.26.B74640F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf20.hostedemail.com (Postfix) with ESMTP id F14221C0003 for ; Thu, 7 Apr 2022 06:42:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649313722; 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: in-reply-to:in-reply-to:references:references; bh=ghX0s+qnM0zTWcdVKam262S3A8knYr1UnlFhPf0e+YY=; b=FyhoZzpY11vitSJi5sLGrR/o6VNUdZQ1pwdvFzWeOToTas2kezY6NKcCy5aHJibtviNuyw KsXiaQTcF2QQ9+JIxeQYh4SkslnYkCD8HcUQPYG5F7PoJ8npYQZyuSitzBwQy+qT7s0xA+ OqFMQgdSoMyVJIBGvRrhcqHgiLxy7z4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-79-HESEfiTVOlu5reogbnkCLQ-1; Thu, 07 Apr 2022 02:42:01 -0400 X-MC-Unique: HESEfiTVOlu5reogbnkCLQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9B4DA811E80; Thu, 7 Apr 2022 06:41:54 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.37.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id E753D401E2B; Thu, 7 Apr 2022 06:41:48 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <164928615045.457102.10607899252434268982.stgit@warthog.procyon.org.uk> <164928630577.457102.8519251179327601178.stgit@warthog.procyon.org.uk> To: Matthew Wilcox Cc: dhowells@redhat.com, linux-cachefs@redhat.com, Rohith Surabattula , Steve French , Shyam Prasad N , linux-cifs@vger.kernel.org, Jeff Layton , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 14/14] mm, netfs, fscache: Stop read optimisation when folio removed from pagecache MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <469868.1649313707.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Thu, 07 Apr 2022 07:41:47 +0100 Message-ID: <469869.1649313707@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Stat-Signature: wxhazrzfebqtc8bju9i9kuc5uh64sg8m Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FyhoZzpY; spf=none (imf20.hostedemail.com: domain of dhowells@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: F14221C0003 X-HE-Tag: 1649313722-962907 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: Matthew Wilcox wrote: > On Thu, Apr 07, 2022 at 12:05:05AM +0100, David Howells wrote: > > Fix this by adding an extra address_space operation, ->removing folio(= ), > > and flag, AS_NOTIFY_REMOVING_FOLIO. The operation is called if the fl= ag is > > set when a folio is removed from the pagecache. The flag should be se= t if > > a non-NULL cookie is obtained from fscache and cleared in ->evict_inod= e() > > before truncate_inode_pages_final() is called. > = > What's wrong with ->freepage? It's too late. The optimisation must be cancelled before there's a chance that a new page can be allocated and attached to the pagecache - but ->freepage() is called after the folio has been removed. Doing it in ->freepage() would allow ->readahead(), ->readpage() or ->write_begin() to jump in and start a new read (which gets skipped because the optimisation = is still in play). Another possibility could be that the FSCACHE_COOKIE_HAVE_DATA and FSCACHE_COOKIE_NO_DATA_TO_READ flags could be moved from cookie->flags to mapping->flags and the VM could do the twiddling itself (no aop required) = - except that fscache can't currently then find them (maybe use an aop for that?). David