From patchwork Tue Feb 13 09:37:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 200877 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp1095364dyb; Wed, 14 Feb 2024 01:37:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUG0Z3XBPdU1l8GjRyasEjCXvU6oQJl3Njc5sFNejwOYn5hgajbN/x9uTUug2AhomyBRh0oxMnBx7+0ND+cRfwJGk+p6w== X-Google-Smtp-Source: AGHT+IGCdeHMVlFYxUALvuIQNI6w+3yKuYHYO1s5qrCUuUZxKgjUt5eyk/N9OPWojHGXQAc0Vcrx X-Received: by 2002:aa7:c24c:0:b0:561:f26e:ae6 with SMTP id y12-20020aa7c24c000000b00561f26e0ae6mr1352684edo.8.1707903453486; Wed, 14 Feb 2024 01:37:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707903453; cv=pass; d=google.com; s=arc-20160816; b=Gd9NRh7D8UFUgPV9lZh9NP5NTHTRkcG+ZycqNHmMXH0Q9i46Mrb1MMd+/OhzFsnp7Z 9hmFyvQiDKkPUUoBUtzpMfiMPg4sFvKYEvgbvM2w3ytsOsOceUXL2/Px71eoKmu2SL2K X5V4gDvYoz6MS7hUsYkoOhyVpNcr18nwrAO0SvDY/vZxGVJGDuYazUhANMEjEpUM3A5p oiy5ZBGVgLV/tF8/2S3Q1md7ObiqG3HisE2b6dN3cmalZH0mqhfNuNw69HGpxgczklOT gafCrHp5qXy9Qya+AsNxf6wN4ozYbyJAxkFTZUdhCjSQj3auXb/xkwBcfxLfhtPILnJU oy/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=s3+v+1l0sQIYfL9D8O6cM5bMDlwybIjei48bqSTyWjw=; fh=AwluRKEMwD/yd/ZQq5aywLIoAMYc4zbn6WcN4y3PYK8=; b=o86r5T1PMvy0qyJk5QyzPJRVU1i+iFIe636HiVdgL9+zS7pdtdwilBE1uzIizd4PUA tdKT5hAqKCC+4RSrP3kY0glQXosfFNrIbs7MRzSPqOstSwgilrFSLZa8RNo+6rRxSJul XWIJbvHOnZ3vmrSKQCwRrPHm7WfMVanV3QrjFtAjUQlY574VkPlCBCyxVu+HY5hlzdZF ssRiEG/epg/cGRx1P52MpWVa8kIo7vIVzBrBRvRHJIVX8zK9AO8v3YSgQ58FTztu0hlA +iHeyOgAlKIpVv0RHW7fPhVH78WValyiV6A4k1FzK+fBSiE2YN8xX7y/pX12LaWfEZt+ hORg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=x6CfVQAW; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-63228-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63228-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCWLUMTZqdyNpOMQXhXxs+MNYyCep6I55canoP2j7h2zjWnIHhBqlm+tHgOdJ4FvcisSujL5PZiSQ6Yy3kHl1L+rlIUuLw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i4-20020a05640242c400b00561f7ec506asi1476537edc.553.2024.02.14.01.37.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 01:37:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63228-ouuuleilei=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=x6CfVQAW; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-63228-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63228-ouuuleilei=gmail.com@vger.kernel.org" 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 6411B1F267E6 for ; Tue, 13 Feb 2024 09:41:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 82D9341C72; Tue, 13 Feb 2024 09:37:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b="x6CfVQAW" Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) (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 6309338F8F; Tue, 13 Feb 2024 09:37:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707817064; cv=none; b=iufK3/yXLKOZTi9sQ2478PAw+hW5YGSE0x3fZOFIt6kFGDKZNYMbFgeOJ5woqwc1E3GBz7mjOcu0fTD8n3ZMOHdsjJZckZHRecHU9cIaFOGFpQYch6BKycCRicCit2PFT4qn3E0vjpahBOncL7vg5Hy0CRM/i4DqImpC1LBK2vo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707817064; c=relaxed/simple; bh=iKbT79kLd7jyelrjB7xgHQdWAkRrlZn0Y/6yOzWx3k0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rgbRqsrkqJdXPytkrXlwCL1qQLEDhezD1CpX3n4Jn0s/M3Wo/8rlISPqpeplhwogEg8YdAUaiTTxB82FssDP/U51MTRzJV6At3NofT5NQGbGGPpE2deVRMsikC3MBblIRzmzD+WM6F2fe1JQOSrMNfqxRJpTGHTc9O4vooXdEq4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none 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=x6CfVQAW; arc=none smtp.client-ip=80.241.56.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none 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 [IPv6:2001:67c:2050:b231:465::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-102.mailbox.org (Postfix) with ESMTPS id 4TYx7l4ntmz9t2m; Tue, 13 Feb 2024 10:37:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1707817059; 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=s3+v+1l0sQIYfL9D8O6cM5bMDlwybIjei48bqSTyWjw=; b=x6CfVQAW4rNsG3L+k95kHbFRenuHprAKwdKZE4SqzOwOs2L6aGmZ1ZQVD8/dJoBhJywTa7 6y8PrO1+vcd3D+x0Iqy3adhK62udO+kGv47JGmZGPVG7qqwA+gbeU/NJnY92pbJuF1EY0l JUstg7eTNj265zR9KXR68yLq9hPsVt7JMoLc8i9Yuiv2JGdztsLselFJepClTBB/njp9tI RG6HjSx+PGhFCUnsXbC9mYVgrbZ+ICPlPMhuKs9iRc8QUGmTUZSCWlB/fNXayyoq4+anHk uone6GAIEb5xnuUWMx9ouMcbT5CHsJzw8G3PIZcC8sKASsD5Z5GQy5wGcDz+jQ== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: mcgrof@kernel.org, gost.dev@samsung.com, akpm@linux-foundation.org, kbusch@kernel.org, djwong@kernel.org, chandan.babu@oracle.com, p.raghav@samsung.com, linux-kernel@vger.kernel.org, hare@suse.de, willy@infradead.org, linux-mm@kvack.org, david@fromorbit.com Subject: [RFC v2 06/14] readahead: rework loop in page_cache_ra_unbounded() Date: Tue, 13 Feb 2024 10:37:05 +0100 Message-ID: <20240213093713.1753368-7-kernel@pankajraghav.com> In-Reply-To: <20240213093713.1753368-1-kernel@pankajraghav.com> References: <20240213093713.1753368-1-kernel@pankajraghav.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4TYx7l4ntmz9t2m X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790804522720939417 X-GMAIL-MSGID: 1790866571370297287 From: Hannes Reinecke Rework the loop in page_cache_ra_unbounded() to advance with the number of pages in a folio instead of just one page at a time. Signed-off-by: Hannes Reinecke Co-developed-by: Pankaj Raghav Signed-off-by: Pankaj Raghav --- mm/readahead.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/readahead.c b/mm/readahead.c index 5e1ec7705c78..13b62cbd3b79 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -213,7 +213,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, struct address_space *mapping = ractl->mapping; unsigned long index = readahead_index(ractl); gfp_t gfp_mask = readahead_gfp_mask(mapping); - unsigned long i; + unsigned long i = 0; /* * Partway through the readahead operation, we will have added @@ -231,7 +231,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, /* * Preallocate as many pages as we will need. */ - for (i = 0; i < nr_to_read; i++) { + while (i < nr_to_read) { struct folio *folio = xa_load(&mapping->i_pages, index + i); if (folio && !xa_is_value(folio)) { @@ -244,8 +244,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; } @@ -257,13 +257,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; } 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); } /* From patchwork Tue Feb 13 09:37:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 200878 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp1095570dyb; Wed, 14 Feb 2024 01:38:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVI8c/UfbN02BLFKmpS6C/u8puhqT+VAfbqtWyDE2Al6aAT+oLuSCrmfEVQYDU1Zzoa4rSh1Q832XDs6/vPaMKoYSj7eQ== X-Google-Smtp-Source: AGHT+IE1qylF+TPWVSuG/TvEI/eFXAC6qdHO6ggKwW5z0V7wMvKbWStQPQFbpX/hkL9FDy/u88fo X-Received: by 2002:aa7:c444:0:b0:562:14fb:53e with SMTP id n4-20020aa7c444000000b0056214fb053emr1676757edr.1.1707903483996; Wed, 14 Feb 2024 01:38:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707903483; cv=pass; d=google.com; s=arc-20160816; b=R2uXLE6isM74L5yWe9wdTsDE1foGpkji0Q8Tg9EVDn1k0TRNVw2+nqVIVM04ZVQAnY xw2YnwsEzLikPlisHZLYqDBilFQsO9d8iLcbTbsGzQUIuAwld2xq+rG/p/hrdKbJ4PZp /iU+JJF0cT+bff0SRv/h25H0d5/TLsNCP2JZPBSa7FEHt1zSeXex2L9vzU+GQ93ct15c 1jnIstWZOlxCPxM/+hVqyG3iuXvEk5fflcLoU+hKNhNsznU1C/Fz3araqkkIiTpcs5Yi ME/TJeSA241c32y/3eHn7rMMITYo+lfiXYcmj3FDcoFx1kOCV0Uu9h/qQxjYBE6IK8ae fZeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=vOt507Ijo5nyZ5wUX3vXhvqctlR5/JOvafIYIWSMCPU=; fh=wnfTHNBzaht1bLPmQY/+LGWRsYRQC5yq2LmC3G1xhHQ=; b=O9daPp+b5wUM5EK/RH3myds3Z/aEW0K34Mx/Q6mxyUNU65c103zQ0e+m+CHgOeP7ok kTU9YxiECZDlSGyI+pxSulszG/rFQ6xZRJLNeFI2F1wMTaW3KZ34bRZXMFjlof+S1udn zJfC23Awo/Va07I71TNloMrwMO18I/0FzoXuOOSDVl+Zy6WcLKOFrpSd8WG/ZHJN7Z0Z SXXpOYkCNYtDkdYCHHKN2OLvnvyuaD4xrw4Umf/CdkOFgG/Glmtsvktuvc/HY8H0wacn nO+pWl72Zq8oCXzWTx40nTl9+yRGi6GjslPeQ1Uuth8X3XEtg7Ga7RnTdJPm+PPYKvPX yR/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=PYSoXXZF; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-63230-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63230-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCVG6U9uMYsuxUcBfRDbSyD/qLzdTIjTEwwukHiXikb9Vh8E/Cs2ts5HKV1EPrQubyjpWY/8VXvuIYm21RO8HgyMk3uddQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z26-20020aa7d41a000000b00560f7f7351dsi4701613edq.613.2024.02.14.01.38.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 01:38:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63230-ouuuleilei=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=PYSoXXZF; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-63230-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63230-ouuuleilei=gmail.com@vger.kernel.org" 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 193C91F26D95 for ; Tue, 13 Feb 2024 09:42:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BCA2550A6F; Tue, 13 Feb 2024 09:37:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b="PYSoXXZF" Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) (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 998C946444; Tue, 13 Feb 2024 09:37:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707817073; cv=none; b=ngLP1k7FFiQkQN/J4j8svMT7TnBKY0g8g+4drcEAjNlTRUrk92YO95ni5Luq7AoUiOPr9whpHBhh3xkHsCWljEJJFPzCNJjwhYK4eacDejv7Lf50OL+fYIf2DB2mgN2hU+ouyq5ZtMoVSX71UPJBRpFc9bPkeDcwISR2Kuk0zKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707817073; c=relaxed/simple; bh=aT7myvwbv8s6n+EpwpZGFT8dH3zqU9o7RwFhXcMPQLg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LXf93ClozDS7ToV449Xu4Ka1F+nU2GpLm+2sgwmgz62ONGG5CwTqIsKX2d4JrgX6nZ/Hu4t5OlK8zytvbufvbB0qIDWkL0hnJBfrPA2tbvMuNkIpts+AgE7FYqtYNk+qnjcRJORHC1swwi3n3BC8HAJhOodRC0WNXXW1qq4sBrk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none 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=PYSoXXZF; arc=none smtp.client-ip=80.241.56.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none 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-102.mailbox.org (Postfix) with ESMTPS id 4TYx7v6WyGz9sp2; Tue, 13 Feb 2024 10:37:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1707817067; 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=vOt507Ijo5nyZ5wUX3vXhvqctlR5/JOvafIYIWSMCPU=; b=PYSoXXZF27fQan8sPatQHAhpAqM4cF203+dvlg+l2btfVaBSRRZiJ1MzdG7gxXCdw/x1xv zyTcd5oYO6PhI3ZFTTCL+6yiaM+Y6yFqYDrBTpKbEIBodE2d741iRoZELCaE88A++S1DY4 rTb77WTAkP4yb3+9A/L0UsVRr/+EI8CsZdN/tVRk429O3hpuT4W5VPTqeszPTncLWrnDU0 7UA6a6QW14Jlo99OKaM/RQfdVcRG6UsIp0cSAOQ7vP8EVJfGVRCfZwh+Jcy59vj6v6E1ie USql3iBXYGMEmlth5qx6Id4J6beIAHNMU9q3QOpfjtUTd+FbUH7EXaWS074UEQ== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: mcgrof@kernel.org, gost.dev@samsung.com, akpm@linux-foundation.org, kbusch@kernel.org, djwong@kernel.org, chandan.babu@oracle.com, p.raghav@samsung.com, linux-kernel@vger.kernel.org, hare@suse.de, willy@infradead.org, linux-mm@kvack.org, david@fromorbit.com Subject: [RFC v2 08/14] mm: do not split a folio if it has minimum folio order requirement Date: Tue, 13 Feb 2024 10:37:07 +0100 Message-ID: <20240213093713.1753368-9-kernel@pankajraghav.com> In-Reply-To: <20240213093713.1753368-1-kernel@pankajraghav.com> References: <20240213093713.1753368-1-kernel@pankajraghav.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4TYx7v6WyGz9sp2 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790796690582328411 X-GMAIL-MSGID: 1790866603754853811 From: Pankaj Raghav As we don't have a way to split a folio to a any given lower folio order yet, avoid splitting the folio in split_huge_page_to_list() if it has a minimum folio order requirement. Signed-off-by: Pankaj Raghav Signed-off-by: Luis Chamberlain --- mm/huge_memory.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 94c958f7ebb5..d897efc51025 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3026,6 +3026,19 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) goto out; } + /* + * Do not split if mapping has minimum folio order + * requirement. + * + * XXX: Once we have support for splitting to any lower + * folio order, then it could be split based on the + * min_folio_order. + */ + if (mapping_min_folio_order(mapping)) { + ret = -EAGAIN; + goto out; + } + gfp = current_gfp_context(mapping_gfp_mask(mapping) & GFP_RECLAIM_MASK);