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 519C5C48BC1 for ; Wed, 14 Feb 2024 13:32:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 89F0E8D0011; Wed, 14 Feb 2024 08:32:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 84DF38D000E; Wed, 14 Feb 2024 08:32:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6EF1C8D0011; Wed, 14 Feb 2024 08:32:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 5F3C88D000E for ; Wed, 14 Feb 2024 08:32:34 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E648940E68 for ; Wed, 14 Feb 2024 13:32:33 +0000 (UTC) X-FDA: 81790498986.17.ADFE063 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by imf13.hostedemail.com (Postfix) with ESMTP id 0C0AE20026 for ; Wed, 14 Feb 2024 13:32:31 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=V99bcL2n; dmarc=none; spf=pass (imf13.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707917552; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=eHn8rk5ik3XE6uaEukHPeObORKT6c7Ek1ETigF2s+IU=; b=Kt3q6ntvdjMmMST/Nir7XRavZ+dHz7nyOO9wW0647iOdrwvTuV0TLgjPem5mfyUbrT405h SNBLASb76Iv3pKBsavTqqEyLSlCm38wUzYg/TCQl4zl9dKemvLkPF53mjBW8tNi+h2ullp V4pNjXY40DufF0UGpj7g7og3wbGeBsg= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=V99bcL2n; dmarc=none; spf=pass (imf13.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707917552; a=rsa-sha256; cv=none; b=LauofKAf7N9QcDklyrQncNmhaYfs8wIuHttO4VohRsBLnFAo2jnia86YcTgNoI3umNK+wM dnh5YaIv6A8ePOyzenAXGOswfJOnNzzz9xe5QjT687L6EwHiMXodCNgLsjltLrWYekW8oU 0pZAvusLzWC/zGoxDoHPr07Qcf8e+xE= Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (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 4TZfJB4HhLz9scX; Wed, 14 Feb 2024 14:32:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1707917546; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eHn8rk5ik3XE6uaEukHPeObORKT6c7Ek1ETigF2s+IU=; b=V99bcL2ni7adjAhC8IHUqrzSr0JqPbj69nW6nPE07i/Pk+2dzFdy90eD4lKa6JNoiVu84o 27Pif9AbwYdbHqemp+GWNUfYl2vJavGsCid4TOKCFJB6pdHktGhQJG4qMok9p/Xugo1YA4 bxnNUvmIhE2XrOrurCJqk334p8ECqROiKRK3+wb3NwTInsz9Wc3S7XwTa2x2lYRzSylhzz X6avpqZSMI388JMNFakWJTCQ4ugZJJtCF6Fjx/QtjJUiM+4t7bgfpJGVdI+lLtOIegIRTk jGM+vw1ua9h3mOSpefZo1o4WrmcXeoP7uoB6jQ9usUm5T+hJGy1TwoN+H3DQyw== Date: Wed, 14 Feb 2024 14:32:20 +0100 From: "Pankaj Raghav (Samsung)" To: Dave Chinner Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, 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 Subject: Re: [RFC v2 04/14] readahead: set file_ra_state->ra_pages to be at least mapping_min_order Message-ID: References: <20240213093713.1753368-1-kernel@pankajraghav.com> <20240213093713.1753368-5-kernel@pankajraghav.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 0C0AE20026 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: dsh9sz9eq4kh9h8uaiey4tbprmax4nkj X-HE-Tag: 1707917551-84197 X-HE-Meta: U2FsdGVkX19UEW75VvOKKj1XrQprFb03U3UKmc3t4ItRwQje+IdFpfdN1s/nEGXBV0IFqsoeXJSZSOTd2S117JCabzyeLiO9w+VVmvq92hz/zST93Qpfe1mnYz1HEWPHQ+I0KwLyYOxcu10UvjplpMR5LMXKXm4m3f7Tgdij2L0VqgLMhc5sJcK37wQF4pVyJGJCkxFzrVMAjwPDxCHtk1P/KPiK/J1HiFdAfb5+p7eURvEPGr3vDYRfS60oJob49XdGO2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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 Wed, Feb 14, 2024 at 09:09:53AM +1100, Dave Chinner wrote: > On Tue, Feb 13, 2024 at 10:37:03AM +0100, Pankaj Raghav (Samsung) wrote: > > 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 > > --- > > 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; > > Why do we want to clamp readahead in this case to io_pages? > > We're still going to be allocating a min_order folio in the page > cache, but it is far more efficient to initialise the entire folio > all in a single readahead pass than it is to only partially fill it > with data here and then have to issue and wait for more IO to bring > the folio fully up to date before we can read out data out of it, > right? We are not clamping it to io_pages. ra_pages is set to min_nrpages if bdi->ra_pages is less than the min_nrpages. The io_pages parameter is used as a sanity check so that min_nrpages does not go beyond it. So maybe, this is not the right place to check if we can at least send min_nrpages to the backing device but instead do it during mount? > > -Dave. > -- > Dave Chinner > david@fromorbit.com