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 84566C433F5 for ; Fri, 4 Mar 2022 03:46:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2190C8D0002; Thu, 3 Mar 2022 22:46:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A18B8D0001; Thu, 3 Mar 2022 22:46:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 069248D0002; Thu, 3 Mar 2022 22:46:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0231.hostedemail.com [216.40.44.231]) by kanga.kvack.org (Postfix) with ESMTP id E5EFA8D0001 for ; Thu, 3 Mar 2022 22:46:02 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id AAB3B18121FB7 for ; Fri, 4 Mar 2022 03:46:02 +0000 (UTC) X-FDA: 79205315364.20.E989F06 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf08.hostedemail.com (Postfix) with ESMTP id B08E8160374 for ; Fri, 4 Mar 2022 03:41:36 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 977441F382; Fri, 4 Mar 2022 02:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1646360604; h=from:from:reply-to: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=E85sAoXCaTA9rJMXOcKl8Th+xCpRXA0b8EAqZxwZ8A0=; b=OHMBIepyGZT5p2vUzh9m6EF2ADllsCUvjfoI6pTTrXo7Yz0B7BDN+ge9IdtF+2ZYydZGCQ 8WoB5pAABgNBYEPVBbEaEnFFjU93OJpcylm9mmoQGVwXSBRAGZ9mDxUgC5aU5qlMH9Ckr8 8JdQlmMLB5FGrAN6piwNc9Z7wosEfx8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1646360604; h=from:from:reply-to: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=E85sAoXCaTA9rJMXOcKl8Th+xCpRXA0b8EAqZxwZ8A0=; b=gt1xKH0idJAvV5toxul/AJtWemJaGkXOxCg34os0vjwsTU/KiA45a4f222DhjpE4Y5De+j w3347cZDZ/LwPhDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8CAE41340A; Fri, 4 Mar 2022 02:23:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Wj8UEhV4IWIXewAAMHmgww (envelope-from ); Fri, 04 Mar 2022 02:23:17 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: "Miklos Szeredi" Cc: "Andrew Morton" , "Jan Kara" , "Wu Fengguang" , "Jaegeuk Kim" , "Chao Yu" , "Jeff Layton" , "Ilya Dryomov" , "Trond Myklebust" , "Anna Schumaker" , "Ryusuke Konishi" , "Darrick J. Wong" , "Philipp Reisner" , "Lars Ellenberg" , "Paolo Valente" , "Jens Axboe" , linux-doc@vger.kernel.org, "linux-mm" , linux-nilfs@vger.kernel.org, "Linux NFS list" , linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, "Ext4" , ceph-devel@vger.kernel.org, drbd-dev@lists.linbit.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 03/11] MM: improve cleanup when ->readpages doesn't process all pages. In-reply-to: References: <164549971112.9187.16871723439770288255.stgit@noble.brown>, <164549983736.9187.16755913785880819183.stgit@noble.brown>, Date: Fri, 04 Mar 2022 13:23:14 +1100 Message-id: <164636059432.13165.6442580674358743838@noble.neil.brown.name> X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: B08E8160374 X-Stat-Signature: jj6qs1aecmu4danawp8qz3js3ipq3s71 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=OHMBIepy; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=gt1xKH0i; spf=pass (imf08.hostedemail.com: domain of neilb@suse.de designates 195.135.220.29 as permitted sender) smtp.mailfrom=neilb@suse.de; dmarc=pass (policy=none) header.from=suse.de X-Rspam-User: X-HE-Tag: 1646365296-103163 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: On Wed, 02 Mar 2022, Miklos Szeredi wrote: > On Tue, 22 Feb 2022 at 04:18, NeilBrown wrote: > > > > If ->readpages doesn't process all the pages, then it is best to act as > > though they weren't requested so that a subsequent readahead can try > > again. > > So: > > - remove any 'ahead' pages from the page cache so they can be loaded > > with ->readahead() rather then multiple ->read()s > > - update the file_ra_state to reflect the reads that were actually > > submitted. > > > > This allows ->readpages() to abort early due e.g. to congestion, which > > will then allow us to remove the inode_read_congested() test from > > page_Cache_async_ra(). > > > > Signed-off-by: NeilBrown > > --- > > mm/readahead.c | 19 +++++++++++++++++-- > > 1 file changed, 17 insertions(+), 2 deletions(-) > > > > diff --git a/mm/readahead.c b/mm/readahead.c > > index 73b2bc5302e0..8a97bd408cf6 100644 > > --- a/mm/readahead.c > > +++ b/mm/readahead.c > > @@ -104,7 +104,13 @@ > > * for necessary resources (e.g. memory or indexing information) to > > * become available. Pages in the final ``async_size`` may be > > * considered less urgent and failure to read them is more acceptable. > > - * They will eventually be read individually using ->readpage(). > > + * In this case it is best to use delete_from_page_cache() to remove the > > + * pages from the page cache as is automatically done for pages that > > + * were not fetched with readahead_page(). This will allow a > > + * subsequent synchronous read ahead request to try them again. If they > > + * are left in the page cache, then they will be read individually using > > + * ->readpage(). > > + * > > */ > > > > #include > > @@ -226,8 +232,17 @@ static void read_pages(struct readahead_control *rac= , struct list_head *pages, > > > > if (aops->readahead) { > > aops->readahead(rac); > > - /* Clean up the remaining pages */ > > + /* > > + * Clean up the remaining pages. The sizes in ->ra > > + * maybe be used to size next read-ahead, so make sure > > + * they accurately reflect what happened. > > + */ > > while ((page =3D readahead_page(rac))) { > > + rac->ra->size -=3D 1; > > + if (rac->ra->async_size > 0) { > > + rac->ra->async_size -=3D 1; > > + delete_from_page_cache(page); > > + } >=20 > Does the above imply that filesystem should submit at least ra->size > pages, regardless of congestion? ra->size - ra_async_size=20 pages should be submitted reguardless of congestion. NeilBrown