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 5EAB7D3B99E for ; Tue, 26 Nov 2024 15:01:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8CFB6B008C; Tue, 26 Nov 2024 10:01:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D3D216B0092; Tue, 26 Nov 2024 10:01:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2BA06B0093; Tue, 26 Nov 2024 10:01:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A51A56B008C for ; Tue, 26 Nov 2024 10:01:13 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 183FFC12CD for ; Tue, 26 Nov 2024 15:01:13 +0000 (UTC) X-FDA: 82828559142.28.41558B7 Received: from granite.fifsource.com (granite.fifsource.com [173.255.216.206]) by imf23.hostedemail.com (Postfix) with ESMTP id 7C856140029 for ; Tue, 26 Nov 2024 15:01:07 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf23.hostedemail.com: domain of phil@fifi.org designates 173.255.216.206 as permitted sender) smtp.mailfrom=phil@fifi.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732633267; a=rsa-sha256; cv=none; b=3D8k3X4+smgW9ZxdPcE0u6ZTq3isZyJKD8WcHJ34vEsdCs7ifWKYPVfGNZB4MW43xLFFcK txrY1BGMvaRLOezL1tQbrssNKYolNpgvF83wxs7g+fQXWXVglefUdzOAeM577+v4JQ8d/O fa9PqVTMzHyKAU/ZvhfPYqUJrX73qe4= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf23.hostedemail.com: domain of phil@fifi.org designates 173.255.216.206 as permitted sender) smtp.mailfrom=phil@fifi.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732633267; 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:in-reply-to:references:references; bh=g/v0ncLeYjX3NyCLeqQtedHVF1ZqzFXRwIlEJDuX53c=; b=npIZHRg+J4qAPkyq5wRBI/Ro/O3MUuzb2cX3N6s/1xGWcRt4eblKp4SAtZRVcfY8oocDc2 dnLpkLVvFYDvcpYyIxgiqB3B3WUGy6Mmb+LV0KMDNK8ENSwK8iQDMeaojL9TeckmDltYzm xdwyjr/DJ14kRjVW3Nn9UKxphCAo2cw= Received: from ceramic.fifi.org (107-142-44-66.lightspeed.sntcca.sbcglobal.net [107.142.44.66]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by granite.fifsource.com (Postfix) with ESMTPSA id 1B1924076; Tue, 26 Nov 2024 07:01:09 -0800 (PST) Message-ID: <9a88fd5fcaad10132c00cfcbcf0f9de9fa47c99c.camel@fifi.org> Subject: Re: [PATCH] Revert "readahead: properly shorten readahead when falling back to do_page_cache_ra()" From: Philippe Troin To: Jan Kara , Andrew Morton Cc: Matthew Wilcox , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Anders Blomdell , stable@vger.kernel.org Date: Tue, 26 Nov 2024 07:01:08 -0800 In-Reply-To: <20241126145208.985-1-jack@suse.cz> References: <20241126145208.985-1-jack@suse.cz> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.4 (3.52.4-2.fc40) MIME-Version: 1.0 X-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Y8hrtMgjOk8E+Nbxvo h89SFSQB dt9ykJQxi95ohvczXcbfw/crF0qBddqaU4vm2MYh8EKN3oqcEJgRs5En6DZdeLP/CAm404C3EfBh9o79O6XEEd7jqCVLCRIaZRpOQFnZqXXnHMS+RJByVuLOkExlO61OtlWoiivL5fQhM6QOi5xviQXG4zCjPGfld5n9zFB9rew9Qjx16NcPL/KiGO1AM//5C+jE67KQiqI/mX4CFiGOVYopU5xGwF2GW7IHN1yZqgVkj1fYzT8HWhOq8Etc/3D9poXJEm57Inrke3/JGkF0AaYHwiHcvFH38L/pOadaN385gpn+McNmJIOMAuQeG+qsx0dzG 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: List-Subscribe: List-Unsubscribe: On Tue, 2024-11-26 at 15:52 +0100, Jan Kara wrote: > This reverts commit 7c877586da3178974a8a94577b6045a48377ff25. >=20 > Anders and Philippe have reported that recent kernels occasionally hang > when used with NFS in readahead code. The problem has been bisected to > 7c877586da3 ("readahead: properly shorten readahead when falling back to > do_page_cache_ra()"). The cause of the problem is that ra->size can be > shrunk by read_pages() call and subsequently we end up calling > do_page_cache_ra() with negative (read huge positive) number of pages. > Let's revert 7c877586da3 for now until we can find a proper way how the > logic in read_pages() and page_cache_ra_order() can coexist. This can > lead to reduced readahead throughput due to readahead window confusion > but that's better than outright hangs. >=20 > Reported-by: Anders Blomdell > Reported-by: Philippe Troin > CC: stable@vger.kernel.org > Signed-off-by: Jan Kara > --- > =C2=A0mm/readahead.c | 5 ++--- > =C2=A01 file changed, 2 insertions(+), 3 deletions(-) >=20 > diff --git a/mm/readahead.c b/mm/readahead.c > index 8f1cf599b572..ea650b8b02fb 100644 > --- a/mm/readahead.c > +++ b/mm/readahead.c > @@ -458,8 +458,7 @@ void page_cache_ra_order(struct readahead_control *ra= ctl, > =C2=A0 struct file_ra_state *ra, unsigned int new_order) > =C2=A0{ > =C2=A0 struct address_space *mapping =3D ractl->mapping; > - pgoff_t start =3D readahead_index(ractl); > - pgoff_t index =3D start; > + pgoff_t index =3D readahead_index(ractl); > =C2=A0 unsigned int min_order =3D mapping_min_folio_order(mapping); > =C2=A0 pgoff_t limit =3D (i_size_read(mapping->host) - 1) >> PAGE_SHIFT; > =C2=A0 pgoff_t mark =3D index + ra->size - ra->async_size; > @@ -522,7 +521,7 @@ void page_cache_ra_order(struct readahead_control *ra= ctl, > =C2=A0 if (!err) > =C2=A0 return; > =C2=A0fallback: > - do_page_cache_ra(ractl, ra->size - (index - start), ra->async_size); > + do_page_cache_ra(ractl, ra->size, ra->async_size); > =C2=A0} > =C2=A0 > =C2=A0static unsigned long ractl_max_pages(struct readahead_control *ract= l, You can add a Tested-by: Philippe Troin tag as I did experiment and validate the fix with that revert on top of 6.1= 1.10. Phil.