From patchwork Tue Nov 26 14:52:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 13886102 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 CC82AD3B996 for ; Tue, 26 Nov 2024 14:52:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 34B046B0082; Tue, 26 Nov 2024 09:52:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2FA936B0083; Tue, 26 Nov 2024 09:52:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1C2BA6B0085; Tue, 26 Nov 2024 09:52:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id F1ADA6B0082 for ; Tue, 26 Nov 2024 09:52:23 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A2E0E1C6C65 for ; Tue, 26 Nov 2024 14:52:23 +0000 (UTC) X-FDA: 82828536798.06.D8055CB Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf04.hostedemail.com (Postfix) with ESMTP id 9201940018 for ; Tue, 26 Nov 2024 14:52:15 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=H4JFcMT9; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=FB96duuY; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=H4JFcMT9; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=FB96duuY; spf=pass (imf04.hostedemail.com: domain of jack@suse.cz designates 195.135.223.130 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732632739; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=PVvC0X2IdzVccD4dVujhCabIRcmUKjGJsrcO3GJg50E=; b=wcCb3s+wxnvEk52bUx+SgYPrglDCFzeG6Ih910uUJ+DWi2T+9SBy9CGt7GB//tR9G6BwgG el6At9J+CZou/FD4Wu/xszf82Ia5HknMxjuhXj3lzFhZmFhNRxoxsp976AgLoW/s8EH4+p TnJcAmQUNGz+tTE1n0pgfQOjVoYQfiY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732632739; a=rsa-sha256; cv=none; b=kFmyxoUn71yG6OZmQ11qaRo40Eh5oQQy+FLJa2Ygzp7AzKYB1VOhXgrKB4y86hOZUE1apc 7m1G0TEuUIBkODvVs3UftLlR6Im6fo2KpmZbui2eM2/2uieivsgz31JYaqYgqzV2jid2Uz PjUr2+yAAoEQkEizgydW4TocOrUvv/o= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=H4JFcMT9; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=FB96duuY; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=H4JFcMT9; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=FB96duuY; spf=pass (imf04.hostedemail.com: domain of jack@suse.cz designates 195.135.223.130 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 739EE21177; Tue, 26 Nov 2024 14:52:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1732632739; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=PVvC0X2IdzVccD4dVujhCabIRcmUKjGJsrcO3GJg50E=; b=H4JFcMT9Lvpaz1hOIbFetsIDZlat5mrEdeIA7IzfX6sWxtf68jN5MEJlAHjGVtGkzxfVKQ GY4a7uIOuHvoeg4677ByPBzwmqaaq2qHMIiJkbxl+y8Hhv3GOWh7mbFh1/FzTDBmvGvfPr MGwh1Nc9PiMHiQ1i8PcM8nAg3Y54KOY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1732632739; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=PVvC0X2IdzVccD4dVujhCabIRcmUKjGJsrcO3GJg50E=; b=FB96duuY/dbWsiYI/wyH7Re7Ji922TvQD0jJKx+ZnObh07fuofJCi3Bhuw4qPBO1ws0r3H yJKdAJNI6gGpzlBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1732632739; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=PVvC0X2IdzVccD4dVujhCabIRcmUKjGJsrcO3GJg50E=; b=H4JFcMT9Lvpaz1hOIbFetsIDZlat5mrEdeIA7IzfX6sWxtf68jN5MEJlAHjGVtGkzxfVKQ GY4a7uIOuHvoeg4677ByPBzwmqaaq2qHMIiJkbxl+y8Hhv3GOWh7mbFh1/FzTDBmvGvfPr MGwh1Nc9PiMHiQ1i8PcM8nAg3Y54KOY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1732632739; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=PVvC0X2IdzVccD4dVujhCabIRcmUKjGJsrcO3GJg50E=; b=FB96duuY/dbWsiYI/wyH7Re7Ji922TvQD0jJKx+ZnObh07fuofJCi3Bhuw4qPBO1ws0r3H yJKdAJNI6gGpzlBQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 5C922139AA; Tue, 26 Nov 2024 14:52:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id T3WTFqPgRWfXfwAAD6G6ig (envelope-from ); Tue, 26 Nov 2024 14:52:19 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 0E0DDA08CA; Tue, 26 Nov 2024 15:52:15 +0100 (CET) From: Jan Kara To: Andrew Morton Cc: Matthew Wilcox , , , Anders Blomdell , Philippe Troin , Jan Kara , stable@vger.kernel.org Subject: [PATCH] Revert "readahead: properly shorten readahead when falling back to do_page_cache_ra()" Date: Tue, 26 Nov 2024 15:52:08 +0100 Message-Id: <20241126145208.985-1-jack@suse.cz> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1952; i=jack@suse.cz; h=from:subject; bh=YH7VUsPQRd833zgqYiGJxBpCkv7rPn0lNro0jtl43rU=; b=owGbwMvMwME4Z+4qdvsUh5uMp9WSGNJdH3S/ejmfOSyiVnaP7STbfZNXzlBgurfveU3at/3ZZ+RV 6s2DOhmNWRgYORhkxRRZVkde1L42z6hra6iGDMwgViaQKQxcnAIwkdYZ7P90D7HPfmdpH6s6+USk9o k1/fbbPZgiNBbr/ZPTSj2cpuAquNW/6aRQIntKwe0aLpNc5jqNHp4VAXp258282lfXm32zLVdlC2eX LBRumz17zv4v/nxcLncPcL8K09b698rwNEOtpnH34dtZUTsjLRhZF+1JOfP9lGMbX0HAXIO0f1baqo ZrQn6/SZJwnclfsSic2W1HbIpR8LqS4qT2/tnP1y5c4Lbk+Zu43wblWQ2RR92v6rqc1Juh7ZW0+/f/ zGLRqS/fVnzZ8fdqVPmtXI7iAumMx8acM+RPh0mxL+atWv+sSCrG57/ZAn195ezfz951ZOy4MC1Sv2 DJOa1u0wYpttNeJzmcKrglfdsB X-Developer-Key: i=jack@suse.cz; a=openpgp; fpr=93C6099A142276A28BBE35D815BC833443038D8C X-Rspamd-Server: rspam10 X-Stat-Signature: rydcebgb3kojc663uh3jnjs5k7xkckab X-Rspamd-Queue-Id: 9201940018 X-Rspam-User: X-HE-Tag: 1732632735-175012 X-HE-Meta: U2FsdGVkX18h9C09oEkEFcxgCJ2s8tCg2kO7ZdU28WRD6U9FFZEAj14zvXrMnrw5xlidQ/EdhUybEa75hm4Q1jE7hK3qRBbwji4PwRMOjzJT88i1vP7Njk+1C6icklgdlSBERaAAG5kKNSVciI3bOe2GBBsfbrlHFESAEOiqLdkGk28Vus4AO7LjX2rJDw884dC4VPU5NGw8JQLynG9hcu5g1cSPvWbpU1fNKY5FXoYqcngCDgv0Z8nJLyvn4iS6kOMona0KkDDqKnxAwRrRT4b+v0G10XD1qnJRZnnXpaRjhKaVWbRZMMf7p/QqVTMCJDvXaE7nSS4ptFO2WCKXZnL6DidqhpQZLddx+9a32Vz+pPNJkR11JEBPivDrtUpLoFa+TtNTZ3hyKBhl0IHrqiUVDgfBAhGiIlObBJrJQbKENPXVU+SHJCOhttQ6W1MGDbu83nl7V7T7Z/90d0B6IU1WDY/NvcCPlxo7nR6OdElTsHN+tugRsSsnFjXEpL2uUbhb0Xth8vdlJ3WNnNnASSF9l1GlkzMzXWqt2/U+Sb6IRAqAkCztB1lllvvQJ2RaUIcgAYyu9qbjDT8sP/JviHnT/MX/nfekWi8BRxyDUDVJkw7xL4WDolUc7BzQxk5caOf0xTH3Payy1Me4ed7eh6+hxuiAc3z6OKrfdcmC0k6WJOo/1Lgm5fCYwaa+pGrip5CEUQ/lFB0+sZu5IKt/9J770GzRRBWwQ+2PItdgN0Ak1LXDveje2rVpiz7cE0N8kNI8yfKUrygACwLomtSKQtNmp1x+Og3jsO3fL1YhvKJ4+XhYm96JmRrtHDR3UlWujfIwAbXCugribFxYfTJKD91stgI3MXYSjb5M/2ZJ/drGYQjFjoG/wdMibKFaygDH8V04WMmwOD8+hVbhNaazmJZRhO4VN4h7L/hk3JSgolAHoNXCunPIehUZW+l1C5xgRyaWf2csbxt/bmIOXWi BhSmjoOt AE9TBDUnFWp25MRvZ8N4L2oWOudUuDzgXZRpcoG95xKKzhMVXV+XeHxgqXhxEchwqudzi2J2mjCbr8pq5y7bgdL+69lFyPWwg4o3wRjk8vlCJmwbXV1ojhy4ecfidxoi6meA3gIhjveqXaseVKG1BTZnuXasIDegBrV+VL9ZpLLVDWNzCXh/DrlEMpCsdyKA2016Y2ukLZ4F33zpZHFyOuu3IRjic4C24pstBIE4B2HmEwgEl3ZDZI5otpvU2ihZge9beQ6DBxOswOj1pI49puKFk0wFpB5k0sUmH/+ARW5Qgczq6ITinx79QEQFyFG4RuN8ahwuzWyXh0/n0qKTSHNHd+aaU5mlwg9N87slhd2yzVAYE+xCcaWx8avqW5aqGYUwRtywRRqyqEVN/l6OYEfihYCwnSTF/SFCP+OG2B3zaZ+UdFxq+MO/b07qHqkS9yXXk5r031VcoZnA72KnSgm8pxw== 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: This reverts commit 7c877586da3178974a8a94577b6045a48377ff25. 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. Reported-by: Anders Blomdell Reported-by: Philippe Troin CC: stable@vger.kernel.org Signed-off-by: Jan Kara --- mm/readahead.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 *ractl, struct file_ra_state *ra, unsigned int new_order) { struct address_space *mapping = ractl->mapping; - pgoff_t start = readahead_index(ractl); - pgoff_t index = start; + pgoff_t index = readahead_index(ractl); unsigned int min_order = mapping_min_folio_order(mapping); pgoff_t limit = (i_size_read(mapping->host) - 1) >> PAGE_SHIFT; pgoff_t mark = index + ra->size - ra->async_size; @@ -522,7 +521,7 @@ void page_cache_ra_order(struct readahead_control *ractl, if (!err) return; fallback: - do_page_cache_ra(ractl, ra->size - (index - start), ra->async_size); + do_page_cache_ra(ractl, ra->size, ra->async_size); } static unsigned long ractl_max_pages(struct readahead_control *ractl,