From patchwork Tue Feb 13 09:37:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13554785 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 77B1BC48260 for ; Tue, 13 Feb 2024 09:37:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 092288D0002; Tue, 13 Feb 2024 04:37:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 027C88D0001; Tue, 13 Feb 2024 04:37:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D62688D0002; Tue, 13 Feb 2024 04:37:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C0A738D0001 for ; Tue, 13 Feb 2024 04:37:38 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 854B3120AB6 for ; Tue, 13 Feb 2024 09:37:38 +0000 (UTC) X-FDA: 81786278196.06.652E10D Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by imf06.hostedemail.com (Postfix) with ESMTP id DBAEA180019 for ; Tue, 13 Feb 2024 09:37:36 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=uCtQvXEu; spf=pass (imf06.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707817057; 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=nJez9lFGKNHHqjTBT9OvccGI+MEPxelY3zNT/AM7wII=; b=eE6s9+bMwq0WyqA1k44HH+R8HajP9vS1QwKmAghqL1T9jjm/Atjaqx4OBi5GEI5EWl3RND QzchgpNEl62KsGdvIeZEZvOfaFcx93tdGdUDglay8AWzAcMtTcRGwnlO8ZOCMaCtHzAAO7 Y0YquKFyuU6iwT1ybEHT9wQ1haJfiGA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707817057; a=rsa-sha256; cv=none; b=BpvPrNuGNqb3JxKAewkyMqWHIXeyqFnlWtCcIfj/Vb6THEpRjd3Ii3/CnPm6gMjBMDXdX+ YAYec6je2JNvC/7oPk6aYHkvGNe+K2+uFEJoSxBejEVzzIilToVRd9jjAZ7TqIa4yjM3hp 1H0EGqOod6ONilbB6+F81aXYcPoZLpM= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=uCtQvXEu; spf=pass (imf06.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.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 mout-p-201.mailbox.org (Postfix) with ESMTPS id 4TYx7d50r9z9sTM; Tue, 13 Feb 2024 10:37:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1707817053; h=from:from:reply-to:subject:subject: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=nJez9lFGKNHHqjTBT9OvccGI+MEPxelY3zNT/AM7wII=; b=uCtQvXEu+6KQlQCiuGw+WSyYea5LbyMcA82MG5gzxpXLndb1cSZu4/VRzPnge4R8I+K8Vv NZYcRK9/bHhRkukWeUhawuEyT7UQoBTZC6FyPTvux6qdgEkJRSaHWjRtW4ro1AkXkTAVYT b55DDYovZ7PBIf5u/a+N56W/LqXlxCoA8gdeOXImwC/a+P5TrtScQQAr9bWyzAu0aHAE4R +oYYuJSkshcJIBYSWUaP265Asnsqute1j4NgcbXErxl+PUNN63BcuLk2DfZLLQiC8PRKf/ C0JlKO3C/DVbujCqHYe28d3whLpp37YQNKOSWJP8AVdWPnpx2/mbjEOXTMKMFQ== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: mcgrof@kernel.org, gost.dev@samsung.com, akpm@linux-foundation.org, kbusch@kernel.org, djwong@kernel.org, chandan.babu@oracle.com, p.raghav@samsung.com, linux-kernel@vger.kernel.org, hare@suse.de, willy@infradead.org, linux-mm@kvack.org, david@fromorbit.com Subject: [RFC v2 04/14] readahead: set file_ra_state->ra_pages to be at least mapping_min_order Date: Tue, 13 Feb 2024 10:37:03 +0100 Message-ID: <20240213093713.1753368-5-kernel@pankajraghav.com> In-Reply-To: <20240213093713.1753368-1-kernel@pankajraghav.com> References: <20240213093713.1753368-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Stat-Signature: b11yzcnwcptrsg5aqxkbojpzqak3g7bb X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: DBAEA180019 X-Rspam-User: X-HE-Tag: 1707817056-354733 X-HE-Meta: U2FsdGVkX19TdAsLWuzh14I0o1cYvK1zOCQJrOVnuQ+7b4RaKkAgJvONd9UhccKhjivWNLszjcxtNzEbklMRSd86naxYCQo1UoHmyBXCHbOWVDubsqZYGqwlxBoBRdZKp5XHYFUy6zvxVU8+jvmCatvlLCCWE395MZzMpuaMj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kIKtjLsHcufzKJjubFu5vphJ12UxrvxphuVQkuCdeYo0pLUSoZUEoQzRh0fJHocFbQH9mB5SV6vn6DyQvHDg7VPcDDFgJgFxk/4GhOX/15q6o+jBBn4ECgxqkhHNZvYiQzrFXlGo= 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: From: Luis Chamberlain Set the file_ra_state->ra_pages in file_ra_state_init() to be at least mapping_min_order of pages if the bdi->ra_pages is less than that. Signed-off-by: Luis Chamberlain Reviewed-by: Hannes Reinecke Acked-by: Darrick J. Wong --- mm/readahead.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/readahead.c b/mm/readahead.c index 2648ec4f0494..4fa7d0e65706 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -138,7 +138,12 @@ void file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping) { + unsigned int min_nrpages = mapping_min_folio_nrpages(mapping); + unsigned int max_pages = inode_to_bdi(mapping->host)->io_pages; + ra->ra_pages = inode_to_bdi(mapping->host)->ra_pages; + if (ra->ra_pages < min_nrpages && min_nrpages < max_pages) + ra->ra_pages = min_nrpages; ra->prev_pos = -1; } EXPORT_SYMBOL_GPL(file_ra_state_init);