Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3216701lqp; Tue, 26 Mar 2024 03:07:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+1+f4a1+9zlq6E+qJC4DmdfeIQ43xnuIEa1AVkYdVOm9rLZq7rXzYpHXC+XFXQZEQhT0LBx7hT8uMG1GWHe88Bo55EDcqDLgqGr4Asg== X-Google-Smtp-Source: AGHT+IHcHgMFZ4FIPKTlshx7joCMbZnShJR63QyrBm1/JfnrMw9XffoUFu02g+50OKc13eQnDCED X-Received: by 2002:a05:6a20:200a:b0:1a3:6d94:d2f1 with SMTP id w10-20020a056a20200a00b001a36d94d2f1mr7735348pzw.58.1711447630065; Tue, 26 Mar 2024 03:07:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711447630; cv=pass; d=google.com; s=arc-20160816; b=HDCZvNbE+Ica5jBubwB7TpmhmEqLkThJFOoPs8GSrY+iCsx7N7xszdZWQUYx5ugI8A spvqPOethoIMK8jNJmt/qtVEO/lushnPVyyLRFBygQHRE1Kj4+5Ph+500VYaOd+hroZe 6ykUIUDwvN7p0L/EP0rwv5lX8IOk6yqFQWan7lvjFBICqV+OMx4eUkHOOgqiNbrwx/is fKrdvj+AZ709KZBnU/OXDaSjq6u81QF53IHqGBl8s/7Fb77pmL7fV0v5VK+GQRTKFypP r1g8aNHz+SIJDj37SOdH/aC8ugz6RPFBaKjH58R5wXnoKdE+pCbbX+6QFQwB15wikkY7 Xg4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=/l44hIRVvOPEpGQpeViqZ0xwsEycYNDv++J/k+vdgEc=; fh=LmbQKK8O9G/ImW7NxunDw1D0EtKktzmtIUmphS0ZlbU=; b=KBbN/0j7FSHEGakQNAB6P5xg7Z440HcHHHgL1MmtYXMOt3wPWUQopSAtdzUaC3mC8E Be8A4x2xcFMqEZtHbY4k9WEFKwOgo9IzpzB5iSQHClkHdyhVQXEAfjkvdznIDOqf8O2u 1EbBGKxvpEMltnpKExEczGRfoI+yQoyTf3f8AQyVr0HdfxXVpi4elfQ03+BgYJfKwj9B AFfWg+UgNCNze+VEdFojlk2cvSBoTLMAq1ToNH07dRO1ZkaSbTh2EvfKG44y2yPwN/4A +ISEetorUtRoowPXzxaqTNmp+36zZOeAT4IRYPpLG0OPOw+dsAC9CDdLY6GXR2tqohZJ WxgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=SKyZ+6qj; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com dmarc=pass fromdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-118742-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118742-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x6-20020a056a00270600b006ea7bc4e2b2si6914355pfv.383.2024.03.26.03.07.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 03:07:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118742-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=SKyZ+6qj; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com dmarc=pass fromdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-118742-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118742-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C26D32E69E4 for ; Tue, 26 Mar 2024 10:07:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 889BB679ED; Tue, 26 Mar 2024 10:06:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b="SKyZ+6qj" Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C2A55A0E1; Tue, 26 Mar 2024 10:06:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711447610; cv=none; b=K/fWo3KwY1L47dyXZ5V5ONtTUF7fxsA4wRKEWoZIQaOnGHvfgKrkFUqOSj/RQGUJFFz5vE3E73VvUSMrjbBmpPK+TK33wuVt3pwpumC7KMdqGs1HzDnn6fn9e0/adExLthKnwdnY5c/UPMF403FJ9LcDRxlF52kXtNw/A18SGHA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711447610; c=relaxed/simple; bh=zDrEdt71S1V5WCgqhPBVSngeotjSuDZavyd+Y5LUUjo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=NDhewmR/ioofhX50xWIFp0TIYqzsJDC6BgL+MS97cL0ijLt2rUWbz/+vMcWBGVC8yq8FMvc3d/JMPJDpLxHo/Xhny3syZI0Xvq2BkM3o8O39QUbQhXG1NYMGwx+RsuE4NqD1JihR4mjg/hKdsHAsl6cAqJhhqK1L/+XufZ6jsxk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pankajraghav.com; spf=pass smtp.mailfrom=pankajraghav.com; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b=SKyZ+6qj; arc=none smtp.client-ip=80.241.56.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pankajraghav.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pankajraghav.com Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (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-202.mailbox.org (Postfix) with ESMTPS id 4V3lnt0K4fz9sSF; Tue, 26 Mar 2024 11:06:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1711447602; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/l44hIRVvOPEpGQpeViqZ0xwsEycYNDv++J/k+vdgEc=; b=SKyZ+6qjmQ6o2EGEB3YUZN55bm155l+3rRdII0vYo0M/FQm42gD9m1nLnv5eZDYcM8sb1n MpMHvjjhdoS2f1QiJOdcwAmc1lDnHiRuc95L3qeYW/siY2sKBVZtMrtCD7OJrIlSeGxTQV Qp0TF6xN5V99E/bFaEng6gD2MEL98WeCv0fWmkjGHBjaMJIk31bzxIueBpp3gbllnSDZWQ uKZ9fKizPoJdLS/5/xpGCIKvtmKKZ+B/KmSOq/7H6uAKkyCieAZ7TZjDgE/mzmZ1V2zI5k 5Q7ehK9AJ1+3cS5w9yoD5/49gaGu3IZb/tFlPs0TZgMWsD/h3/mxtoUrPswqOA== Message-ID: <1a4a6ad3-6b88-47ea-a6c4-144a1485f614@pankajraghav.com> Date: Tue, 26 Mar 2024 11:06:36 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v3 04/11] readahead: rework loop in page_cache_ra_unbounded() Content-Language: en-US To: Hannes Reinecke , 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> From: Pankaj Raghav In-Reply-To: <3aa8bdf1-24f6-4e1f-a5c4-8dc2d11ca292@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. > Cheers, > > Hannes >