Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4949576rdb; Fri, 15 Sep 2023 18:46:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHp1izX/7tp57y4W6pighmu9PO5btNV7Lvr+UU3QCEcw5Y/VyJoHr9ZpH59Tv9532Pz7HYz X-Received: by 2002:a05:620a:4015:b0:76f:1c78:42f1 with SMTP id h21-20020a05620a401500b0076f1c7842f1mr3598500qko.67.1694828787516; Fri, 15 Sep 2023 18:46:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694828787; cv=none; d=google.com; s=arc-20160816; b=QJeVg70HEj2zHa4hqkswxO8VjpWpnK3r0rBjowKkod/Ii1MokAh1H7GEQDHFPUtiAJ wP+dD38UA5RvOd5v2ljLVjDTYvg0H+4Kn8imsYunzRYSGLGW8NeSp1PWixsD+rwc94nv DJ2KLaGsti6nxlsS9Rhz8PM7N8sjX5G1lVuasJl8bjdMfB31jCzlqd/lWAgcE6dGMw2m VwJ1kXuzKoDCIWkwwyf/nFAcqWP2xOf3Jsr6W5Xeyy4uGGyBk6ZW2YAu0m3BtL3KZjn+ FRS2HPksDID6mqQueWtrix2b0IYSgCblYOnQqgIq11OJPrEFIJlpIQHRw+K3kjwGzQvo +72g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=591wcX/aNYK1i2+Gpz2G47nBurFy4yzLeb3z8BH/s7c=; fh=kl+S4GAUWD1kOeoqBopscteh2mu3DZslcHc01dOJ6TI=; b=jiJPPiF5uWVpxZePgiyVLJ1gH61lx8N/rQRUCABQX+4TuTPBM9AEIPS31/cBasaZJ7 jJzQn3vDOdC0Vf0CsdhMnFX6m7mqMhr6xNo79zTPhhukuL+xcI+UTdORXZQmWWaCC4VG YaPsBGanJsCdgSfq8acEDCTyWOzRj4towJJlWoOqFPLQpXfL7igyJ9rptsKEjP6AJQ+y N58AaoF+JX/9WXei9Cgnggk7oHpJPvnPhtukyiaDsxYxIj3agraJz/pvdpxkwrs3XE5Z bjjF79IR/4I+1+qKot2ZC2LrJdvlnD9zYZhnDOiTttJllM92p1Cf9oTDCYULIbhJ275T cwaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=vcPcMUF6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id f19-20020a056a0022d300b0068bc14cabc0si4218275pfj.31.2023.09.15.18.46.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 18:46:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=vcPcMUF6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 8FC0E8024CC8; Fri, 15 Sep 2023 11:42:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236834AbjIOSmK (ORCPT + 99 others); Fri, 15 Sep 2023 14:42:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236825AbjIOSlp (ORCPT ); Fri, 15 Sep 2023 14:41:45 -0400 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23A344206; Fri, 15 Sep 2023 11:40:22 -0700 (PDT) Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4RnNJg0GXfz9spB; Fri, 15 Sep 2023 20:39:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1694803171; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=591wcX/aNYK1i2+Gpz2G47nBurFy4yzLeb3z8BH/s7c=; b=vcPcMUF61bQ2Sox+rVmcmmFCT5EqJKJRSDzMWuT3qx6Cthz50vAI4MWCBIJ+/FXhvQQT73 aUeCtC3yGQQ9yF6AYkBBl/xbuC7mwlJcI6rdrJUfFIxTR6mKGWW+d8riBrqwJycp2FTOK+ rSdoOS7Y9ZY2iIqkKtC/1Mzz0BmkWZt3aY7oRXjFsQGGWCf7vZNYfMMwkyXPXqdMYBuSqv YshJdlp/P1VfVHttkHmJg2rDfDIzV5tFlpdaI9rPLXUlzcICnaqjt1ipzU55sAxa6mse0B f3qJ8/OF95BjLF3LDOCPsStttf1OOn3/f/YPMTzUtd/kfRx+XXvz7QdxF3gFbA== From: Pankaj Raghav To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: p.raghav@samsung.com, david@fromorbit.com, da.gomez@samsung.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, willy@infradead.org, djwong@kernel.org, linux-mm@kvack.org, chandan.babu@oracle.com, mcgrof@kernel.org, gost.dev@samsung.com Subject: [RFC 14/23] readahead: allocate folios with mapping_min_order in ra_unbounded() Date: Fri, 15 Sep 2023 20:38:39 +0200 Message-Id: <20230915183848.1018717-15-kernel@pankajraghav.com> In-Reply-To: <20230915183848.1018717-1-kernel@pankajraghav.com> References: <20230915183848.1018717-1-kernel@pankajraghav.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4RnNJg0GXfz9spB X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 15 Sep 2023 11:42:39 -0700 (PDT) From: Pankaj Raghav Allocate folios with mapping_min_order order in page_cache_ra_unbounded(). Also adjust the accounting to take the folio_nr_pages in the loop. Signed-off-by: Pankaj Raghav --- mm/readahead.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/readahead.c b/mm/readahead.c index 5c4e7ee64dc1..2a9e9020b7cf 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -250,7 +250,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, continue; } - folio = filemap_alloc_folio(gfp_mask, 0); + folio = filemap_alloc_folio(gfp_mask, + mapping_min_folio_order(mapping)); if (!folio) break; if (filemap_add_folio(mapping, folio, index + i, @@ -264,7 +265,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, if (i == nr_to_read - lookahead_size) folio_set_readahead(folio); ractl->_workingset |= folio_test_workingset(folio); - ractl->_nr_pages++; + ractl->_nr_pages += folio_nr_pages(folio); + i += folio_nr_pages(folio) - 1; } /* -- 2.40.1