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 E20E9CD11DF for ; Tue, 26 Mar 2024 10:55:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5FB886B009C; Tue, 26 Mar 2024 06:55:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5AC5E6B009D; Tue, 26 Mar 2024 06:55:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47C746B009E; Tue, 26 Mar 2024 06:55:12 -0400 (EDT) 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 381F56B009C for ; Tue, 26 Mar 2024 06:55:12 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id E3DE41608F5 for ; Tue, 26 Mar 2024 10:55:11 +0000 (UTC) X-FDA: 81938883222.29.931693F Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf18.hostedemail.com (Postfix) with ESMTP id 4C7E51C000C for ; Tue, 26 Mar 2024 10:55:09 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=kUiYxGNW; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=XfxE6I62; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=kUiYxGNW; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=XfxE6I62; spf=pass (imf18.hostedemail.com: domain of hare@suse.de designates 195.135.223.131 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=1711450510; a=rsa-sha256; cv=none; b=xLrJnQlccS+cwtZ6e+xbrAjZMb5XhCFQCndvOn5rzFDry6GWzAdAV3XtX5CoT8Z5h69UjW UreatO1tZMo7A7l6qAIpCbvMxSyPKmc+d3qcAQuhnDxufIUwk+QG44NQrD90c0ueq6F9eV jhkPR6ZybNBpA1nmypRMBL5UcWxoUvY= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=kUiYxGNW; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=XfxE6I62; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=kUiYxGNW; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=XfxE6I62; spf=pass (imf18.hostedemail.com: domain of hare@suse.de designates 195.135.223.131 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=1711450510; 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=VTAHC+dMlqgS5jsreRqLtBqwCP2zNUfrzfIGXEK/tJY=; b=U0Nqsq6F809xn0fYy4gEtS8IY0nUA53eg3Yr2mxBa9559vrxpThTR28iZ2KAFRfTpC4gBK MoZFJYKAjAbjtfDwbyOn99yYX1E8lMyvNu+j8R5PAjco7t6mhj/AKAH24pVqiC3nyNhOnI vzPN8Y8T/8ODJdkO4Ld2pNLmmpjAQ5Y= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [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 779CE5D4A1; Tue, 26 Mar 2024 10:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1711450507; 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=VTAHC+dMlqgS5jsreRqLtBqwCP2zNUfrzfIGXEK/tJY=; b=kUiYxGNW8v1k6TKo4T89QY29viOegU1qT3isgfEoFTaC493EP2ZsBan/tb77soJ16nWnAx MXMUqkyoMP5sQPYazm7w2wNVncvYH/FoYatI4S1QgK1ELdH8UKEimAuqWuj39azqw/x58d xzQh25s1/vqr6cWtKtilsY9JQ4Bn0U0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1711450507; 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=VTAHC+dMlqgS5jsreRqLtBqwCP2zNUfrzfIGXEK/tJY=; b=XfxE6I627pa79m+G1W4LYwVMCyb0DfGUrcnsaVE4lG3C93QValJUsOpvYKy0THWSTwFSyS zk3p+W8lspJ2LEAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1711450507; 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=VTAHC+dMlqgS5jsreRqLtBqwCP2zNUfrzfIGXEK/tJY=; b=kUiYxGNW8v1k6TKo4T89QY29viOegU1qT3isgfEoFTaC493EP2ZsBan/tb77soJ16nWnAx MXMUqkyoMP5sQPYazm7w2wNVncvYH/FoYatI4S1QgK1ELdH8UKEimAuqWuj39azqw/x58d xzQh25s1/vqr6cWtKtilsY9JQ4Bn0U0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1711450507; 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=VTAHC+dMlqgS5jsreRqLtBqwCP2zNUfrzfIGXEK/tJY=; b=XfxE6I627pa79m+G1W4LYwVMCyb0DfGUrcnsaVE4lG3C93QValJUsOpvYKy0THWSTwFSyS zk3p+W8lspJ2LEAA== 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 4FBFE13306; Tue, 26 Mar 2024 10:55:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id LzwFE4upAmZ0CAAAD6G6ig (envelope-from ); Tue, 26 Mar 2024 10:55:07 +0000 Message-ID: <2b1a2ded-d26f-4c9e-bd48-2384b5a7c2c9@suse.de> Date: Tue, 26 Mar 2024 11:55:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 04/11] readahead: rework loop in page_cache_ra_unbounded() Content-Language: en-US To: Pankaj Raghav , Matthew Wilcox Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, gost.dev@samsung.com, chandan.babu@oracle.com, mcgrof@kernel.org, djwong@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, david@fromorbit.com, akpm@linux-foundation.org, Pankaj Raghav References: <20240313170253.2324812-1-kernel@pankajraghav.com> <20240313170253.2324812-5-kernel@pankajraghav.com> <7217df4e-470b-46ab-a4fc-1d4681256885@suse.de> <5e5523b1-0766-43b2-abb1-f18ea63906d6@pankajraghav.com> <3aa8bdf1-24f6-4e1f-a5c4-8dc2d11ca292@suse.de> <1a4a6ad3-6b88-47ea-a6c4-144a1485f614@pankajraghav.com> From: Hannes Reinecke In-Reply-To: <1a4a6ad3-6b88-47ea-a6c4-144a1485f614@pankajraghav.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 4C7E51C000C X-Stat-Signature: qoyz75gajkpck1oqsimw7yywgwenu4j5 X-Rspam-User: X-HE-Tag: 1711450509-268779 X-HE-Meta: U2FsdGVkX194z+acOKc+RDh8r5/7V/z2IECxaCTibPlSlj7cnBwp0ozJft5sT5ozVnk/xtdpV4+OngMksfBsLffCVEhxvOpyO/RdPZisBEL6DckZMJ75RolsnZ5upuR7dZMxktm0C9T/KtXq71NKFaGbkG42XUCxs3+22ctxZlfHbXRK0R8sjOMlwVYkU6An32dlCxFbQy+sNRnPfkT/NItYtZH69To7Dt8DOIt0YllTCn9bFDKSJHXVrqi2JAOBGIXi+NCGJdFQFvHrqoAYeB12oIbCZMm76TA8fDpfUhovYojKfqX6iZi+6+NS+I5eABhCmY8bf7W7Uwwra9TqhQb0FSXt8N56EVJno6PBcScw8GtLFgMX9uylQNVSFf0BAMSiFe5HiSkZrQYgWIqFpq2D9oOP9+0PchPLcRplZSAGh+yQVrAlBk0Fuf34uJk3swb6itdf9bj/7FeToTevRrsP6t03HvbNAQgMabMpeL50JYr0Z9lCnA8v5GH2vwFSs5UZgJBUueU1+BFw8sWg6yTFA54/nmll5z/xMTxMEQr5ANC2cGhhN+t3LWFtiw3+AKSkDMuYzB3g4+XzKROraWSdi6YfufAZfum5OYY8SEc++QdgCcavcg1nVjQs1L4bi1XPQdkA+XaRsd1qt6IGl86BXLxS63YEqY2cwyU6aOjueH2SvWNEtpqjUE67XNyhxMniZfosquDNa4L6FvjpRRgmm3CAH5vDdbhBO2RFD8YjehefmnMqfAejvXS8QFA6Z3OzjLwzVCQ6Hv+ugwPSwJ/9d7bBb73Q2I5q7ySKO8BgwXRuF7x5ebSup4n+yWQiiHi2AAJGi8LLSV+uGZYcIzZUskMd64KmnCzbxrtVeLKCoOnGSTnwV6Fzz8xQ70KmWOb8ALBXzSSXHRAvApQp3r43qp6SXWx2ZK3TcZEGq0LekQ7TBsm2bic9Dw6eG/lcir3BGpc0RytesKg8n70 siFwBktF khIf7t/7lKZ7ww+s1K1WQCYqTmMTIUea85Yk7 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 3/26/24 11:06, Pankaj Raghav wrote: > On 26/03/2024 11:00, Hannes Reinecke wrote: >> On 3/26/24 10:44, Pankaj Raghav wrote: >>> Hi Hannes, >>> >>> On 26/03/2024 10:39, Hannes Reinecke wrote: >>>> On 3/25/24 19:41, Matthew Wilcox wrote: >>>>> On Wed, Mar 13, 2024 at 06:02:46PM +0100, Pankaj Raghav (Samsung) wrote: >>>>>> @@ -239,8 +239,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, >>>>>>                 * not worth getting one just for that. >>>>>>                 */ >>>>>>                read_pages(ractl); >>>>>> -            ractl->_index++; >>>>>> -            i = ractl->_index + ractl->_nr_pages - index - 1; >>>>>> +            ractl->_index += folio_nr_pages(folio); >>>>>> +            i = ractl->_index + ractl->_nr_pages - index; >>>>>>                continue; >>>>>>            } >>>>>>    @@ -252,13 +252,14 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, >>>>>>                folio_put(folio); >>>>>>                read_pages(ractl); >>>>>>                ractl->_index++; >>>>>> -            i = ractl->_index + ractl->_nr_pages - index - 1; >>>>>> +            i = ractl->_index + ractl->_nr_pages - index; >>>>>>                continue; >>>>>>            } >>>>> >>>>> You changed index++ in the first hunk, but not the second hunk.  Is that >>>>> intentional? >>>> >>>> Hmm. Looks you are right; it should be modified, too. >>>> Will be fixing it up. >>>> >>> You initially had also in the second hunk: >>> ractl->index += folio_nr_pages(folio); >>> >>> and I changed it to what it is now. >>> >>> The reason is in my reply to willy: >>> https://lore.kernel.org/linux-xfs/s4jn4t4betknd3y4ltfccqxyfktzdljiz7klgbqsrccmv3rwrd@orlwjz77oyxo/ >>> >>> Let me know if you agree with it. >>> >> Bah. That really is overly complicated. When we attempt a conversion that conversion should be >> stand-alone, not rely on some other patch modifications later on. >> We definitely need to work on that to make it easier to review, even >> without having to read the mail thread. >> > > I don't know understand what you mean by overly complicated. This conversion is standalone and it is > wrong to use folio_nr_pages after we `put` the folio. This patch just reworks the loop and in the > next patch I add min order support to readahead. > > This patch doesn't depend on the next patch. > Let me rephrase: what does 'ractl->_index' signify? From my understanding it should be the index of the first folio/page in ractl, right? If so I find it hard to understand how we _could_ increase it by one; _index should _always_ in units of the minimal pagemap size. And if we don't have it here (as you suggested in the mailthread) I'd rather move this patch _after_ the minimal pagesize is introduced to ensure that _index is always incremented by the right amount. Cheers, Hannes