From patchwork Wed Dec 4 18:10:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 13894162 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 C00D3E7716D for ; Wed, 4 Dec 2024 18:10:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 243C06B0083; Wed, 4 Dec 2024 13:10:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EC816B0089; Wed, 4 Dec 2024 13:10:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E42DC6B0085; Wed, 4 Dec 2024 13:10:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AFA376B0082 for ; Wed, 4 Dec 2024 13:10:33 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 668DE14116D for ; Wed, 4 Dec 2024 18:10:33 +0000 (UTC) X-FDA: 82858066074.27.8F919C9 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf07.hostedemail.com (Postfix) with ESMTP id ACFB440016 for ; Wed, 4 Dec 2024 18:10:15 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=tLgNrw2S; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=AJF4o5Wr; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=tLgNrw2S; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=AJF4o5Wr; spf=pass (imf07.hostedemail.com: domain of jack@suse.cz designates 195.135.223.131 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=1733335815; 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:in-reply-to:references:references:dkim-signature; bh=YRRVp8GDv5ciFU8Vi3NK539eFxAC9ZKJdJnKCRgH7L8=; b=uxBrxotpI4dQyD1OBalPgoOqH6F/LuzrciwUq9V1sIEoUtwSb96nPWgyLfLFrJVAeg+9ul lz+xbWmrtfSG4rS9vVvctjjTL2xknJ2Dgepod5pEZuQkwzIDX7p2Hc60SwlQcxt/RvOAoa J2thduCND7YsJ/Xp1EFIL5V60cP7cF4= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=tLgNrw2S; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=AJF4o5Wr; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=tLgNrw2S; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=AJF4o5Wr; spf=pass (imf07.hostedemail.com: domain of jack@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733335815; a=rsa-sha256; cv=none; b=kshrXMzyOvxJi1f6fdP4JHDNuOEQf/kePWvUE5qodQIV6DKn7x7DNhThWuDHzfFjjh77ua qwmqRwGNIbYCJcw9kkYQQU3N3rm8gdbFHTRgrCO4PK9dOkZFI4/PxRYiEgyUzamHgiFXLz j9I7B49CMb5N3DcNezaPlAdjEN2h2js= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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-out2.suse.de (Postfix) with ESMTPS id 280101F391; Wed, 4 Dec 2024 18:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1733335829; 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: in-reply-to:in-reply-to:references:references; bh=YRRVp8GDv5ciFU8Vi3NK539eFxAC9ZKJdJnKCRgH7L8=; b=tLgNrw2SSinViQkbbJRU+fhzUy6L+N8bkRvx9sxjHg8WLiumifZKfiTexcaRAUTOv0wa0w 3Y82DQ9MALJYn0FQ2KdiRp6xqwDLXLiONu1eSiADkCD38w84ZMC+rkWg6Q+HDrEHM8uieO Gja0WfdIGNwDkgJ/GOgVFNRLebD+q9Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1733335829; 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: in-reply-to:in-reply-to:references:references; bh=YRRVp8GDv5ciFU8Vi3NK539eFxAC9ZKJdJnKCRgH7L8=; b=AJF4o5WryyXhlaKQNsx1NmW9touxveeG+Yh4OrVREWMDrbRGJ7ZvPALcKaB67tcsRBLMqr 0CRHuYF+bT6grGBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1733335829; 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: in-reply-to:in-reply-to:references:references; bh=YRRVp8GDv5ciFU8Vi3NK539eFxAC9ZKJdJnKCRgH7L8=; b=tLgNrw2SSinViQkbbJRU+fhzUy6L+N8bkRvx9sxjHg8WLiumifZKfiTexcaRAUTOv0wa0w 3Y82DQ9MALJYn0FQ2KdiRp6xqwDLXLiONu1eSiADkCD38w84ZMC+rkWg6Q+HDrEHM8uieO Gja0WfdIGNwDkgJ/GOgVFNRLebD+q9Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1733335829; 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: in-reply-to:in-reply-to:references:references; bh=YRRVp8GDv5ciFU8Vi3NK539eFxAC9ZKJdJnKCRgH7L8=; b=AJF4o5WryyXhlaKQNsx1NmW9touxveeG+Yh4OrVREWMDrbRGJ7ZvPALcKaB67tcsRBLMqr 0CRHuYF+bT6grGBw== 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 1507E13A41; Wed, 4 Dec 2024 18:10:29 +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 L4jbBBWbUGcfJAAAD6G6ig (envelope-from ); Wed, 04 Dec 2024 18:10:29 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 9B992A089B; Wed, 4 Dec 2024 19:10:20 +0100 (CET) From: Jan Kara To: Andrew Morton Cc: , Matthew Wilcox , , Jan Kara Subject: [PATCH 1/2] readahead: Don't shorted readahead window in read_pages() Date: Wed, 4 Dec 2024 19:10:15 +0100 Message-Id: <20241204181016.15273-2-jack@suse.cz> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20241204181016.15273-1-jack@suse.cz> References: <20241204181016.15273-1-jack@suse.cz> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1372; i=jack@suse.cz; h=from:subject; bh=A4tsTegl357UhkwXDmfPLpj1g2fDGSUagcySv02HY9k=; b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBnUJsGMzu51Nl5sO9cmnme2WMMG2Vp67WUyVvFoI6H PEQeuvuJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCZ1CbBgAKCRCcnaoHP2RA2VbNB/ 9e6QWAakdEIqj7QtPm5A6RZs+LXzV1dLegNIC+NW7PamHW+WaiXxQ3DnnvfWndYND4lSLtLVaYNeZz ViLXV9/vlwd9Iff2j+IZjf81DBfh7o7/r6BewIYlgtIjWhRY/JAPo7wxA0+fORtN9l+hE8OgmMqPFE 6RMyMbPL5pog0Ig3LTotHkm/UfS7qjjdHn9FzEmtLqOCg8SNF+7ZpEWviVwiXLIXOJtRxsQEZiqbYN 8iCY/p144rKTwteAmADMPbQHaEkWwrjdAm0J4Q6ZhUARVqj+CPC4H1pcom+lr31JX9zO/u1ZTOoPjg Jt0hQ3QbrNaMvwTpBXkIaUCjxPSrpB X-Developer-Key: i=jack@suse.cz; a=openpgp; fpr=93C6099A142276A28BBE35D815BC833443038D8C X-Rspamd-Action: no action X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: ACFB440016 X-Rspam-User: X-Stat-Signature: 3mczh79jsffas3ap9hfyie84sgaya6im X-HE-Tag: 1733335815-419125 X-HE-Meta: U2FsdGVkX18lzwPIBo50D90b984vXxXfCaD36p2qKt2TNg76Un4QOJrRGXXFoYDVpi3YMoE/S/7gSM9TNMdLw/nNXPNusmc06EiSpsNJJq56qcAVJ227UVQBVqNqBDkaosOBftK0pi8tZl4vlqSbFDkcVIMzmY+HjZMU6LPOBrAgVR8wdqOCur9UGq8Ayma1Jv4wQnMugHbkmZanhZ+Y7F+fEw5qNSV0tXd4hmviBV88pC6ygTofqJ6bRhpYpG5S/zyw4yzbBUG03W5gjHC/6g9BhjeyzRL+Zk5ywhHaXbU6bW7YcgX5qCIh/qohpJhI9vDZTVpb5REpWewww0nnV2uqFckle79zph+w0d/dmtnVU4U8EtnUlkX8oz2swZMr4olwU4aQtSTIaHFiXaXlNah+s995az3HhlR4K+H+we2dqRqsUTGM27NaqWmW2rN5xqTs1bYSFSKUERJICsR6CXTUjdFt7+Ww0YiyuevqW+r0RTClTy3COoR7xHovv1dXwCdrpTnBomLL4E2aZyDK36zdjiTGxPPJtb2zCQT6Jh0I6GBEpUAHR+QOD8SH97lO9QhnWVQ7ff5YbQZ9NfF/EzfTcqLw3X/oc3EsNFAhA69gYCaASNNtCONYlMmThmHM7HqxTDc86rh5wYnPljOTDnhD2usuFcHgtxgtKEUXxea+ZL+wqRSzqrYwb/G6AZEJEuwznR7e0jOUXIUtWlfBXK31BdID1M3qoS5CgV422FU7h/J+Lxb1XRfiuhXAqA3hkP1xnX3062iQBH6ppgjoy4orMFsUpyZSiY1kyXBuBtSW4kE49QbDvOLrsAoXddoYCOQxh+qg3B/pnF01CQKTC5Eda+6JITkOIfg119afboVbKRVFzcALuN8erD+40DlI3huE9O07IUchr5fenaqw9pbEQs5LySbklC+HlVJxfoGnHhjjyp7aKzeXaOOVu+5pcjF4UEYs9XzKWMoY8FL UtUWWwie mC2l6FyCRokoShw6fVQx5C5nDqrNjQonR+2Kmbzu1Vdq0BBEi2aNFH+GWihOXwNy6//g1e0FV0ynv9oRT34GTTQkQbuTGi+GxSkRhoNWG05TuwUcTmzmrAPXPXhr/SXmsER8utpx3UjpMdg9Aq5JSXvrQD2pLl8Eqjugf6eKT5WcAtqRqpxhjTsVVPUpW1E7Jk0C4aBWd0TszDkSGTcZlX/nr/50YKDtF+O8hROknn/AAXS3zvYTPQW3hoiQid/CM1XniD1OJcK5d4d84B/TRBlFuhM56Dg0yKgm1 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: When ->readahead callback doesn't read all requested pages, read_pages() shortens the readahead window (ra->size). However we don't know why pages were not read and what appropriate window size is. So don't try to secondguess the filesystem. If it needs different readahead window, it should set it manually similary as during expansion the filesystem can use readahead_expand(). Signed-off-by: Jan Kara --- mm/readahead.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/mm/readahead.c b/mm/readahead.c index ea650b8b02fb..78d7f4db9966 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -158,20 +158,10 @@ static void read_pages(struct readahead_control *rac) if (aops->readahead) { aops->readahead(rac); - /* - * Clean up the remaining folios. The sizes in ->ra - * may be used to size the next readahead, so make sure - * they accurately reflect what happened. - */ + /* Clean up the remaining folios. */ while ((folio = readahead_folio(rac)) != NULL) { - unsigned long nr = folio_nr_pages(folio); - folio_get(folio); - rac->ra->size -= nr; - if (rac->ra->async_size >= nr) { - rac->ra->async_size -= nr; - filemap_remove_folio(folio); - } + filemap_remove_folio(folio); folio_unlock(folio); folio_put(folio); }