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 BBE47C27C4F for ; Fri, 21 Jun 2024 13:28:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1766B8D016E; Fri, 21 Jun 2024 09:28:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 125F28D0138; Fri, 21 Jun 2024 09:28:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EBAD28D016E; Fri, 21 Jun 2024 09:28:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id CCF178D0138 for ; Fri, 21 Jun 2024 09:28:11 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 50ADF160F03 for ; Fri, 21 Jun 2024 13:28:11 +0000 (UTC) X-FDA: 82254974382.21.4C3AD86 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf18.hostedemail.com (Postfix) with ESMTP id E6B541C0010 for ; Fri, 21 Jun 2024 13:28:07 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=T5iKPGsh; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="/Dq6fTzn"; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=T5iKPGsh; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="/Dq6fTzn"; spf=pass (imf18.hostedemail.com: domain of hare@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=hare@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718976474; 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:dkim-signature; bh=BJCuq+h5u3aPiWrkexa1qYa0vicdpzfh6UYJP9LV0a4=; b=uWeImmuQt/ZAKUrNtdIfFRK6SDtislqFa8ECqSRX3KsJAbZhTlNRbxv+oK5h+LmdS+r9RQ vYPbYxj24WrtTBd08G8vkN/I2S/IAXwp6COhFR/9GwxIfnLYmhLSR2ama8EPfdE94AJLg8 mACuwLCeVIWqf/lQW2U8/B9TpC3QfKI= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=T5iKPGsh; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="/Dq6fTzn"; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=T5iKPGsh; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="/Dq6fTzn"; spf=pass (imf18.hostedemail.com: domain of hare@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=hare@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718976474; a=rsa-sha256; cv=none; b=Yj2NU1K/hhRka1cElL/vfASmJihezHvVptDF/PaBV9Vtj3N2mI6r+3IleCBtyJCGhv8gd3 I5WRMpw2VoyIu3VbDJ1jYeH64PMZSRD2Ftn5Mz33YiI6E2Rr2WNRAXFzo4X5qsE4L8CfI4 nTtMiILQmyeEJp/3jUVZSGC+HO2dAVI= 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-out1.suse.de (Postfix) with ESMTPS id 31326210F0; Fri, 21 Jun 2024 13:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718976486; h=from:from:reply-to: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=BJCuq+h5u3aPiWrkexa1qYa0vicdpzfh6UYJP9LV0a4=; b=T5iKPGshDECy3ig2kF+G9FsBsOQ2KN6xZjXV+C3GxzI4s5wJTv5Yz4zlIIZZrc5iBmPwQt DY12WSbrERDETH3qye3KLnfKQJmjqA103giLa5q93YvB06Yd+fvxSIfHJx/3ZA2qxNi8Xn BJilSOrydVDXT4uG+ArcYegO3PY7yRA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718976486; h=from:from:reply-to: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=BJCuq+h5u3aPiWrkexa1qYa0vicdpzfh6UYJP9LV0a4=; b=/Dq6fTzniVTfsGx5mdV1MQh1MJcoZa+vH0uXFNbRwXRbnS4vbhZVGyFzkSxOPdlaI2hVYf TOZ0fuH3RNglGRDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718976486; h=from:from:reply-to: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=BJCuq+h5u3aPiWrkexa1qYa0vicdpzfh6UYJP9LV0a4=; b=T5iKPGshDECy3ig2kF+G9FsBsOQ2KN6xZjXV+C3GxzI4s5wJTv5Yz4zlIIZZrc5iBmPwQt DY12WSbrERDETH3qye3KLnfKQJmjqA103giLa5q93YvB06Yd+fvxSIfHJx/3ZA2qxNi8Xn BJilSOrydVDXT4uG+ArcYegO3PY7yRA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718976486; h=from:from:reply-to: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=BJCuq+h5u3aPiWrkexa1qYa0vicdpzfh6UYJP9LV0a4=; b=/Dq6fTzniVTfsGx5mdV1MQh1MJcoZa+vH0uXFNbRwXRbnS4vbhZVGyFzkSxOPdlaI2hVYf TOZ0fuH3RNglGRDQ== 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 E875E13AAA; Fri, 21 Jun 2024 13:28:05 +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 0y/EN+V/dWZ4FAAAD6G6ig (envelope-from ); Fri, 21 Jun 2024 13:28:05 +0000 Message-ID: Date: Fri, 21 Jun 2024 15:28:05 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 04/11] readahead: allocate folios with mapping_min_order in readahead To: "Pankaj Raghav (Samsung)" Cc: Matthew Wilcox , david@fromorbit.com, djwong@kernel.org, chandan.babu@oracle.com, brauner@kernel.org, akpm@linux-foundation.org, mcgrof@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, yang@os.amperecomputing.com, Zi Yan , linux-xfs@vger.kernel.org, p.raghav@samsung.com, linux-fsdevel@vger.kernel.org, hch@lst.de, gost.dev@samsung.com, cl@os.amperecomputing.com, john.g.garry@oracle.com References: <20240607145902.1137853-1-kernel@pankajraghav.com> <20240607145902.1137853-5-kernel@pankajraghav.com> <20240614092602.jc5qeoxy24xj6kl7@quentin> <20240617160420.ifwlqsm5yth4g7eo@quentin> <20240617163931.wvxgqdxdbwsbqtrx@quentin> <20240621121903.xbw4j2ijy4k32owv@quentin> Content-Language: en-US From: Hannes Reinecke In-Reply-To: <20240621121903.xbw4j2ijy4k32owv@quentin> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Action: no action X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: E6B541C0010 X-Stat-Signature: hs458yt4p5omm9us7dre6mutmuhxdzw7 X-Rspam-User: X-HE-Tag: 1718976487-21316 X-HE-Meta: U2FsdGVkX19IDg7a7cfKzVwM4233FxKu0GDilkbR4jowUKJj9EkPw8b+XQKmpvhqnUJ9JSOZ8+VY8Exe0YavEAkv+ZyFKW3b8bCeDdEJ7soBXWPfDzgkKSYW7gZxdChKDCfqOf1WFMUxDpKDz+2IUyPM1hhOHvKM0L6JvWozDGHXh1yEFZDuGjoyHtKuQH3hpziKM9HyBW22oJbEqen7Hv90VJbGjTISQKAJHl2+VN62MXCyhyvP5xStySUysuBkow6nIffWwxqnUog/3HZytB7SoLD2uiMoh0u3sJpjSPsjSauEJ8/xON54MQrBwV6SJN2Mq6jIur/Nt2CRq/aOQqXhrEHAx2HSeMTgdzqyGAPQeZkK4IzhgS41ySjNlOiHxrwa00NASEGuT4yGCQaWgvxsB8/11GUNhRSmp+3rjF54WsXiHlpNBEwbEBfMSn/g6yrby89mfOyTigVV1wOqRZk/aDb9Y6DynUJt0f+2IOGx9kpnkcOiVZ8EN3et97mCLI0lQ1BFl/P1hkvpX0GfF94LANlfiUV8i+tnVH8P1nInnga4ebcbOZZHVqntSY0zY3Sta2aAEqNYw63P7QY/d07cI2Hmas+VsbkRHg0oL0x8oF31J9Mje+LXr7OPTd4ldXYS68gvQHT3gn1ulkqjSjWLJBTHSBG6sh/3Gh+mvsbPYi8BlWapRiIGgHZjsLMgsEGIalOT9RbsRO9L6Z4UOKWZzWOWtMLidRzaj8tf/+aQFcIpxB5BdeSjyw7RwAxGuxQYyvYHwJg/IjBAQ6YyJWQLGceZnKmalCcS4KdRyYeQuDL4l0yJX1HfqkaaIvg+7/xG6/pT93CZx2MC9kpR4pSxSOQ4E+czZHNbtgnLxgFXS98um/swoXEDvNKAuauJQKOueJ+umCtKH9Er+kwPdiS9oPXPBhf98kUkEVb7QiQgJIPQ84V0d2ofE2LwSZHGGvSGo84Z7WqzHvQEk+4 GYwIwrRe XMx1Jdo4Tq4mhfdrxI2wkVUePKzcQr4QR+YOTAEL+TXuxUm1Lst4JWuRugmLsbUDpU4j6xpSEdyVr10sRPj+rto0awO94r9QYZUNQnENmTdsCjF6x41qMo1F4X1bGyeTKQDokU2ZSOyu0NNn7LMsN+4GpjWdQKLyQM8aUl4WMEiBNKsgedD0F8aomSki3EjpE+dUaoBTR0p98Me7p2AnYUAfSx/t6BfIQIrYkZKHS1G1mEaODxAEcZE85vdQ3E55NYCqE70Gk4tuQQsb9auKfaZ5mM5xud+w1YMX0gpYLYfjQZ39TmUk9Ji2aqo2hZQgFCwnSwjXXR/FaGjGSOz6+dNywn1eTlARG7gQ2Ltib4Ds49ZA= 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 6/21/24 14:19, Pankaj Raghav (Samsung) wrote: > On Tue, Jun 18, 2024 at 08:56:53AM +0200, Hannes Reinecke wrote: >> On 6/17/24 18:39, Pankaj Raghav (Samsung) wrote: >>> On Mon, Jun 17, 2024 at 05:10:15PM +0100, Matthew Wilcox wrote: >>>> On Mon, Jun 17, 2024 at 04:04:20PM +0000, Pankaj Raghav (Samsung) wrote: >>>>> On Mon, Jun 17, 2024 at 01:32:42PM +0100, Matthew Wilcox wrote: >>>>> So the following can still be there from Hannes patch as we have a >>>>> stable reference: >>>>> >>>>> ractl->_workingset |= folio_test_workingset(folio); >>>>> - ractl->_nr_pages++; >>>>> + ractl->_nr_pages += folio_nr_pages(folio); >>>>> + i += folio_nr_pages(folio); >>>>> } >>>> >>>> We _can_, but we just allocated it, so we know what size it is already. >>> Yes. >>> >>>> I'm starting to feel that Hannes' patch should be combined with this >>>> one. >>> >>> Fine by me. @Hannes, is that ok with you? >> >> Sure. I was about to re-send my patchset anyway, so feel free to wrap it in. > Is it ok if I add your Co-developed and Signed-off tag? > This is what I have combining your patch with mine and making willy's > changes: > > diff --git a/mm/readahead.c b/mm/readahead.c > index 389cd802da63..f56da953c130 100644 > --- a/mm/readahead.c > +++ b/mm/readahead.c > @@ -247,9 +247,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, > struct folio *folio = xa_load(&mapping->i_pages, index + i); > int ret; > > - > if (folio && !xa_is_value(folio)) { > - long nr_pages = folio_nr_pages(folio); > /* > * Page already present? Kick off the current batch > * of contiguous pages before continuing with the > @@ -259,18 +257,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, > * not worth getting one just for that. > */ > read_pages(ractl); > - > - /* > - * Move the ractl->_index by at least min_pages > - * if the folio got truncated to respect the > - * alignment constraint in the page cache. > - * > - */ > - if (mapping != folio->mapping) > - nr_pages = min_nrpages; > - > - VM_BUG_ON_FOLIO(nr_pages < min_nrpages, folio); > - ractl->_index += nr_pages; > + ractl->_index += min_nrpages; > i = ractl->_index + ractl->_nr_pages - index; > continue; > } > @@ -293,8 +280,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, > if (i == mark) > folio_set_readahead(folio); > ractl->_workingset |= folio_test_workingset(folio); > - ractl->_nr_pages += folio_nr_pages(folio); > - i += folio_nr_pages(folio); > + ractl->_nr_pages += min_nrpages; > + i += min_nrpages; > } > > /* > Yes, that looks fine. Go. Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich