Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3185474lqp; Tue, 26 Mar 2024 01:56:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWzEwY6J9uifsDvDohbqlXdCnXvLsyn/L1r9jOksY7/II9nsMhL8fuelqdbNqcIqhSLizKaHzOZduq/f9NOStlQAtAqPDAtRZwiGvYohg== X-Google-Smtp-Source: AGHT+IFXK+CkrM9RAO3SPrEAmGUkfIhAoFWgnc81tg5g0WUz93tHQMhDCRoeeL+VwuCqw3AzFbxq X-Received: by 2002:ac8:7d55:0:b0:430:da8f:e9be with SMTP id h21-20020ac87d55000000b00430da8fe9bemr534073qtb.4.1711443391539; Tue, 26 Mar 2024 01:56:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711443391; cv=pass; d=google.com; s=arc-20160816; b=bFEHBcG2PnYDNusQCDNl61yUrEmCxM5V56s2wiJhDOBflLA/cQVs2tVkBbYWeaJphA JiYa9r4tcM12Qyo7BA8XMtXXYsQLW3pOkFdyvKtgViSMyquQLSzv242w52SNmt5wfDuR Cd85+MbEWEhw2Ge3+mH8NGfg0F1uNt79yv+0H7LooVTl3Y/zzuUvwSyWg0DefQPRdUnx 2GOVekSbrLVagQOwYUJIq6gufLz967xSVoCmbhL0uezxpJ2sykWsElTDiKfCE8pj+jKv RN3HCjQ9HmYKku7Ib1QKLUsXARSn0AYw5INnW83hF1sMmhVmC2Xx/eS8tTeOY/wKPhBH +IXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XpgxVlBKjKrVn9MhWjJ6FRn4nkr5mAP1dQnGjR12Avg=; fh=4BkQj7bEHEpPJCGIFyAHCeh1+r+ebo3THwcGxMRYBbc=; b=d5W6/cGZ8fhhtqnBDVOWG9zW8zRPHiAqkyTu7WJ8+p+ZaAFSnxXey33BSiMXQVPsBv wcOllDMxxvdfuHWvVKgtI/GqCQWoS2pLA9b7wZBT4+/rqeces3mR9tHXpAk3oSWFDyQK 5GUXZM/7x29xBEjKNkgpNHc4b9v2buoS0rxDyczKDJU3z4hDsGiOqUE93w81klQgBJja zVB9YyeaJpmS36si6zgwu6GyhwS0+4xV1xriVnTRR40uTrllqAa5SYzTeqr5bSzmAyoC QhmyBg/ZxUyyrxJJjQolUXjRvW3ppwJlRyN2L3G5+w4ojPz0v04IVOvxFaIPsZ2AN6/Y QI1w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=S9FEMClW; 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-118585-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118585-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h13-20020ac87d4d000000b00431752db740si182220qtb.177.2024.03.26.01.56.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 01:56:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118585-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=S9FEMClW; 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-118585-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118585-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 48DBD1C349C6 for ; Tue, 26 Mar 2024 08:56:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 023D94F1F8; Tue, 26 Mar 2024 08:56:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b="S9FEMClW" 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 75A22495E5; Tue, 26 Mar 2024 08:56:11 +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=1711443373; cv=none; b=umDl86JLQMtlGyz1nG8282DVZsL2bcMVTi6VUnHrF/mMhsABCdaL7gTBvnhltZC+G/y1w6NIK1C4cAzk5biPJ4OSYvTdWneXMCPmbh6GqMDZ+Gr58X63HCfNlClLRMmoglBNF/G8MYmARF0xA95XiZBS8BclCNb5jqVkQqY39M4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711443373; c=relaxed/simple; bh=nagYxxDbJgL0+8mtzKa/n0XbQhGhLQBTIa31bE0Psjs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RUod455J7OLuX7dKOgk7f1xMJOUi+N34/g9iIAFClJlKf5Q98AL4AjQgoVDsk/xtcFjT5kTH9jUTB2PejsKDfVmJ+o8GFC6/j9ekPYd81xFgKbTxMqGPrz2bYMKd4hBmBH8JB5kRvTmi/nge6qmubiWbh5V9cjkzPKyjQfNweWk= 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=S9FEMClW; 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 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-103.mailbox.org (Postfix) with ESMTPS id 4V3kDR6xxLz9sTd; Tue, 26 Mar 2024 09:56:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1711443368; 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=XpgxVlBKjKrVn9MhWjJ6FRn4nkr5mAP1dQnGjR12Avg=; b=S9FEMClWMRg7xZPklOmpzcCTtZL6hs5IPFqYBeDYTHgvVoG9iP+ig0BwtYQ24gWWU2WVCS 3uSyUcJDu/feCaAGss7hbXuMV1f0RrERROceks+RyRpxyerWfUppHtZrGWbJSjaHHYznXv +eBATqmcyV4lMfTtIDODQTaZIjlygvXZWFQoL8bsOcd0LLkhrPGNgD7LX3Xl/9eiqRYQ2n 3iEMMo/TZU4Y34gywx+YT1J1F24P0n3drx4HOzz70jetX96Gde9+CweznN9KLk2ohW5yxu Mmcofwg52MFgM7Ut9N5KR2S766fXlDWgpZnRfbcl+kcz2AORsZYnqAEwDx/b2A== Date: Tue, 26 Mar 2024 09:56:03 +0100 From: "Pankaj Raghav (Samsung)" To: Matthew Wilcox Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, gost.dev@samsung.com, chandan.babu@oracle.com, hare@suse.de, mcgrof@kernel.org, djwong@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, david@fromorbit.com, akpm@linux-foundation.org, Pankaj Raghav Subject: Re: [PATCH v3 04/11] readahead: rework loop in page_cache_ra_unbounded() Message-ID: References: <20240313170253.2324812-1-kernel@pankajraghav.com> <20240313170253.2324812-5-kernel@pankajraghav.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4V3kDR6xxLz9sTd On Mon, Mar 25, 2024 at 06:41:01PM +0000, 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? The reason I didn't use folio_nr_pages(folio) in the second hunk is because we have already `put` the folio and it is not valid anymore to use folio_nr_pages right? Because we increase the ref count in filemap_alloc() and we put if add fails. Plus in the second hunk, adding the 0 order folio failed in that index, so we just move on to the next index. Once we have the min order support, if adding min order folio failed, we move by min_order. And your comment on the next patch: > Hah, you changed this here. Please move into previous patch. We can't do that either because I am introducing the concept of min order in the next patch.