Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3208133lqp; Tue, 26 Mar 2024 02:48:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV3/7zdhRSH1C+U4z28wCq3XFJC5rOmI+zz9vQM3mpQtTAmPHvZQuxcv5o2iaRBxME3+TixsQma/3ZMQk7vSnVQeCZ4X1y8Aun9ODuwtw== X-Google-Smtp-Source: AGHT+IHd9VrqyRdLD6G62ZSBM4ZdIQ9RAkY0j85TYsc82ht757ddJE6q2erEpzdenJ3BSKRiPUUx X-Received: by 2002:ac2:5f87:0:b0:513:2cb2:53a1 with SMTP id r7-20020ac25f87000000b005132cb253a1mr6469198lfe.53.1711446489956; Tue, 26 Mar 2024 02:48:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711446489; cv=pass; d=google.com; s=arc-20160816; b=rgjQpgpCcY/69Z6dbKR5G8FmUCmwWYaQ4w2mKH/VBvkc8qnniDxTgu7OfugZQ0K+M5 oRPZfo19jTAJouBTBs0iXaHh90dv2GVUT35hzccbyC6xAiBpBl9jSaScuhv4RrSfWFdB 59mEBhlafGeBk2lDhcbGuRKaGEKTU/8g2sKyHjSb0fdO8bOWc4UNL1FAmTTFmqN60UIk U6ZmuLsZBl8x1IWYeEQgRm/2nbfcpAoK7sZN7IZz6eocmC3pAFHbi9pFDg+tU2XvE4Hk yFVg1nsXxYJkiWnAtQbxJE8GB1avKvf+w0/7/t8Ri7+e7fcze8+Q4KHmFbi5KtKhn90j EAVQ== 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=YrxaH5mDWbAQSraF+LJ/aFHOMZvEWk75cjO9z38h3ds=; fh=LmbQKK8O9G/ImW7NxunDw1D0EtKktzmtIUmphS0ZlbU=; b=b83tiKlSZqowSFsqOCYZKOLZqZ0WIAgkrakaPMjgW5HqjjNu3842iof6VxihDC7k1O wrVQp4k+05gyZvP4DJ2iCEGF7EEI6u6vs/fGstf8KgXe8+DwXAgyuGmtsK+R5rU+cR8L OrfzEOGud174/yyBYhr5zckhuo8oFSbq/Xfz3jO5rBS/Ow5WE5e8YUd29HruOEu0MEt2 IMnmq/ioS3VtPtHx/wSJh/DnMpw+K+V6xyiNOLdl3cvOO/AXhNZ6VUfBLwSAAc6Vm1GV OpKqfzCmpMmZieYzzyndKTfQCD8RSATWmN6lCgTVt1AUzlUE6IA1bPUxOxeBv87IaCdS dLsQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b="WpQ+Ny/V"; 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-118707-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118707-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u6-20020a170906780600b00a46e0eb45basi3546416ejm.677.2024.03.26.02.48.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 02:48:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118707-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b="WpQ+Ny/V"; 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-118707-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118707-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8A4291F3A63F for ; Tue, 26 Mar 2024 09:48:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 691296F08E; Tue, 26 Mar 2024 09:44:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b="WpQ+Ny/V" Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) (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 BDE6E10A19; Tue, 26 Mar 2024 09:44:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.161 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711446254; cv=none; b=iIE7tyvIb1bKRWbip27c28qWlen3sizUj6nhvTQAe8huDa+3LdZPvjIgHl1784gGoTAMwNY81SF/YBugj+3/STmXgkt5mfwa/nAeRxWQzkjIenR6FflcVTqFMPAdldRsVxZy54jn11ENamldOKZxvQWpSOU1icX6MGqNoBLV2Xo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711446254; c=relaxed/simple; bh=otwNxssUTqC8hixZ724zKmTu0LPn+6xgWSR2/3zJtqA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=g2SXGePh2lb5xF+JVO3/eRFuloLkeAbTyPe1x5DlBNTj+nhQinA/L5iXXZaHmT0mvcQLlO5MMKm8CFqiRWVJdBvV0K5bCN+7jIPmsNyUsiPrnRVzlo3Sewt8MdtxWdIZbu94M0ZmsmquQIV+DkwiVvp6S/un6SQJdlNt/J6iHGY= 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=WpQ+Ny/V; arc=none smtp.client-ip=80.241.56.161 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 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-103.mailbox.org (Postfix) with ESMTPS id 4V3lHr6bWfz9scb; Tue, 26 Mar 2024 10:44:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1711446248; 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=YrxaH5mDWbAQSraF+LJ/aFHOMZvEWk75cjO9z38h3ds=; b=WpQ+Ny/VkIGZVysTH9mt6ac6RJIyCQebBhbHlxffuvruRXKXPbTkzElPZGzrve3xAMydqz FzwRyBnZHBfacuxH6PnJB8Bf2FbqGz9YWC2THPAs9/Rq5Cnrv2Y3pfWlbhZhv5RO3FrVMF N7rBO3rjyZhniq35YhDDYlFMWpAgwkeMPjPc98/zmWCggjAIJlL/B3sPeJ93UWO8swi9bP VNEOiZ2fS2J3aSpm+Bs1m5GwKCu7yXFOjkPmpp48UafhHQM3lKS85eHfvVH+pGt3rzgs5S vg8Z5qaYNPqqQ6dPRygBDajkpk2y3m9pi0ejAzbH6PPK7VaVGZKbr2T9ZcMIxQ== Message-ID: <5e5523b1-0766-43b2-abb1-f18ea63906d6@pankajraghav.com> Date: Tue, 26 Mar 2024 10:44:02 +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> From: Pankaj Raghav In-Reply-To: <7217df4e-470b-46ab-a4fc-1d4681256885@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. > Cheers, > > Hannes >