From patchwork Wed Jun 21 08:38:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 13286856 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FB75EB64D8 for ; Wed, 21 Jun 2023 08:38:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231249AbjFUIig (ORCPT ); Wed, 21 Jun 2023 04:38:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbjFUIib (ORCPT ); Wed, 21 Jun 2023 04:38:31 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C351710E6 for ; Wed, 21 Jun 2023 01:38:28 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230621083827euoutp02879bb0ed861808457e1b540386e969f1~qn8ugi5uS0616906169euoutp02D for ; Wed, 21 Jun 2023 08:38:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230621083827euoutp02879bb0ed861808457e1b540386e969f1~qn8ugi5uS0616906169euoutp02D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1687336707; bh=p+ceLN5ku7io/26SFBn3OjERPGRRlK1fZyar/4zm1hE=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=Pbg9tlpu43bSlPstWN1z2aHRMRhP9yYMjrT+938dBQS2kg+pCATCsv3EssKYLsNwR 0zrQlqCEa/36bbVctj8ZPghsV+jBGds3qGACru66FQPhTXg1j+tbruTzQxgvOgBzVM 3gkqs7EiMZ1n/sn3pcg1uq5n4lT55wVo4xKKCLkw= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230621083826eucas1p10a3c96207c0a16f84fd975a996fe662a~qn8uHF7p82121821218eucas1p1X; Wed, 21 Jun 2023 08:38:26 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 6A.7C.37758.207B2946; Wed, 21 Jun 2023 09:38:26 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230621083826eucas1p11fc8d3e023caafa8b30fd04c66c9c7d0~qn8tyilf71725417254eucas1p1_; Wed, 21 Jun 2023 08:38:26 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230621083826eusmtrp1ebc64a4952224c75cae2a6bbd5708f81~qn8twaleB0064800648eusmtrp1C; Wed, 21 Jun 2023 08:38:26 +0000 (GMT) X-AuditID: cbfec7f5-7ffff7000002937e-be-6492b702d655 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 9A.D8.10549.207B2946; Wed, 21 Jun 2023 09:38:26 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230621083826eusmtip2c5a952dde2b7c93e4a70881e76d21c04~qn8tjM7TM0773907739eusmtip20; Wed, 21 Jun 2023 08:38:26 +0000 (GMT) Received: from localhost (106.110.32.140) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 21 Jun 2023 09:38:25 +0100 From: Pankaj Raghav To: , , CC: , , , , , , Pankaj Raghav Subject: [RFC 1/4] fs: Allow fine-grained control of folio sizes Date: Wed, 21 Jun 2023 10:38:20 +0200 Message-ID: <20230621083823.1724337-2-p.raghav@samsung.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621083823.1724337-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Originating-IP: [106.110.32.140] X-ClientProxiedBy: CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) To CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) X-Brightmail-Tracker: H4sIAAAAAAAAA01Se0xScRTe7168XWjU9VrjpGWLVX/Qoqy27grL1mP0Mre27LWK4KYkkuNq L7NhmqU9Jcsg2ir/0HRlApYkpZEJiGmPaVjr/ZjLXCt1SbWWeK3533e+851zvm87JE6bwyJJ rT6dNehVOikhEtxsDLZOx26ZNDO7mmYwjsZXiHFdMWHM1YoHGNPefBxjXHd8AubpbSvBBE5/ RMyvfisRRyqbroDSXiZT2srzCWVth5FQ2v2Zyh5bdAKxUaTQsDrtbtYwY8E2UXKtvyEs7cz4 vdYqK2FENkkBEpJAzQHj8ypBARKRNFWGoL7wRhhf9CIo6csfwRc9CJznHejfyBtb/9BIKYJ+ zy38vyrb4h1U0ZQDgSeYWIBIkqBkkB3aJCTHUHFgr7IOnsAp18C97O9YqBEx0HBVBwZFAmoK 5FzLJ0JYTM0H78snYaE9QE2EkjcQooWUAqqu3kO8JBx85g+CEMYHJDnVF3AeA9zr7MR501Iw 2psFPM6CJsdzLOQBqH4S3IcfDyVbAqXXnUOiCPjscYzg8Xjwnzk+xGfCx8AvnB/ORXDKWUnw 5ubDyWYdr1kEroJWxNOjINAdzvsZBaabxThPi+FoHn0aTbYMS2AZlsAyLMElhJcjCZvBpSax 3Gw9u0fOqVK5DH2SXL0r1YYGvsf/x9NXg8o+f5O7EUYiNwISl44RT7CZNLRYo9q3nzXs2mrI 0LGcG0WRAqlEPC3Wp6apJFU6m8KyaazhXxcjhZFGzBnTnfDzmIYe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Gpj2PCussruv7/q9iPm1RFbCFvHX oYbmGaabuN+fCzmz9JVjqfw0//UWV1KfGH9POCs65+GVWTs2cmUe39EaV6x/gWlbA2uLx/re t1/3bAqM5S76eW2xXZy7yoazcVk2Pa3fvidILb3nu7aKd0FO3TZW78aYBKYmHyeGTc8kszgE VsXvCo8y1s6e1PPu8BQlPeE5HczbNEN9dxrHhJVcfGHWbqKpKVs88c1SoeVnv3lZfI4Q333v nYhy8aHCQ15NmeU2FzdWTcw5sLtuM8fZo/euJpS+WCQrwNw6KZyrYPPVvemMH6w85U3PhE6S 3r15XWPCs+duz9+43/jSvkPNM6Nlm7KUi1JEt7/11ZmT65RYijMSDbWYi4oTAStx/jBVAwAA X-CMS-MailID: 20230621083826eucas1p11fc8d3e023caafa8b30fd04c66c9c7d0 X-Msg-Generator: CA X-RootMTR: 20230621083826eucas1p11fc8d3e023caafa8b30fd04c66c9c7d0 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230621083826eucas1p11fc8d3e023caafa8b30fd04c66c9c7d0 References: <20230621083823.1724337-1-p.raghav@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: "Matthew Wilcox (Oracle)" Some filesystems want to be able to limit the maximum size of folios, and some want to be able to ensure that folios are at least a certain size. Add mapping_set_folio_orders() to allow this level of control (although it is not yet honoured). [Pankaj]: added mapping_min_folio_order() Signed-off-by: Pankaj Raghav Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Hannes Reinecke --- include/linux/pagemap.h | 46 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 716953ee1ebd..462c36c9dd88 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -202,9 +202,15 @@ enum mapping_flags { AS_EXITING = 4, /* final truncate in progress */ /* writeback related tags are not used */ AS_NO_WRITEBACK_TAGS = 5, - AS_LARGE_FOLIO_SUPPORT = 6, + AS_FOLIO_ORDER_MIN = 8, + AS_FOLIO_ORDER_MAX = 13, + /* 8-17 are used for FOLIO_ORDER */ }; +#define AS_FOLIO_ORDER_MIN_MASK 0x00001f00 +#define AS_FOLIO_ORDER_MAX_MASK 0x0002e000 +#define AS_FOLIO_ORDER_MASK (AS_FOLIO_ORDER_MIN_MASK | AS_FOLIO_ORDER_MAX_MASK) + /** * mapping_set_error - record a writeback error in the address_space * @mapping: the mapping in which an error should be set @@ -294,6 +300,29 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask) m->gfp_mask = mask; } +/** + * mapping_set_folio_orders() - Set the range of folio sizes supported. + * @mapping: The file. + * @min: Minimum folio order (between 0-31 inclusive). + * @max: Maximum folio order (between 0-31 inclusive). + * + * The filesystem should call this function in its inode constructor to + * indicate which sizes of folio the VFS can use to cache the contents + * of the file. This should only be used if the filesystem needs special + * handling of folio sizes (ie there is something the core cannot know). + * Do not tune it based on, eg, i_size. + * + * Context: This should not be called while the inode is active as it + * is non-atomic. + */ +static inline void mapping_set_folio_orders(struct address_space *mapping, + unsigned int min, unsigned int max) +{ + mapping->flags = (mapping->flags & ~AS_FOLIO_ORDER_MASK) | + (min << AS_FOLIO_ORDER_MIN) | + (max << AS_FOLIO_ORDER_MAX); +} + /** * mapping_set_large_folios() - Indicate the file supports large folios. * @mapping: The file. @@ -307,7 +336,17 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask) */ static inline void mapping_set_large_folios(struct address_space *mapping) { - __set_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags); + mapping_set_folio_orders(mapping, 0, 31); +} + +static inline unsigned mapping_max_folio_order(struct address_space *mapping) +{ + return (mapping->flags & AS_FOLIO_ORDER_MAX_MASK) >> AS_FOLIO_ORDER_MAX; +} + +static inline unsigned mapping_min_folio_order(struct address_space *mapping) +{ + return (mapping->flags & AS_FOLIO_ORDER_MIN_MASK) >> AS_FOLIO_ORDER_MIN; } /* @@ -316,8 +355,7 @@ static inline void mapping_set_large_folios(struct address_space *mapping) */ static inline bool mapping_large_folio_support(struct address_space *mapping) { - return IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && - test_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags); + return mapping_max_folio_order(mapping) > 0; } static inline int filemap_nr_thps(struct address_space *mapping) From patchwork Wed Jun 21 08:38:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 13286858 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C73CEB64DC for ; Wed, 21 Jun 2023 08:38:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230294AbjFUIim (ORCPT ); Wed, 21 Jun 2023 04:38:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231146AbjFUIie (ORCPT ); Wed, 21 Jun 2023 04:38:34 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 693371981 for ; Wed, 21 Jun 2023 01:38:29 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230621083828euoutp02e6a87b8839d883c42a6f0976e8847ab4~qn8vVmqQg0634806348euoutp023 for ; Wed, 21 Jun 2023 08:38:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230621083828euoutp02e6a87b8839d883c42a6f0976e8847ab4~qn8vVmqQg0634806348euoutp023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1687336708; bh=p3mOYJ8f1hVTCexaglZ7i/L8HoJqlurEbyVlQliHZdg=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=RaplaNf1wD/mwGTQe7KrTATIyCaJoFt2irKviIfjU0pDW6CWKHtrBLCHDHKQvwqpk 6b0rBkL0UzeXgIfPw8hSf11Hfl7g4KDbdK1Tt8Y4hoLoGhAkiKlceQMWHFq6aozxvY S4tAdL5htcY1Q5vHyb4BzPLzcTGONgw3f+gD3JDg= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230621083827eucas1p1911afb01b8e07c4de65ceb9ae1cca543~qn8vFJWSq2121821218eucas1p1Z; Wed, 21 Jun 2023 08:38:27 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 91.2A.42423.307B2946; Wed, 21 Jun 2023 09:38:27 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230621083827eucas1p2948b4efaf55064c3761c924b5b049219~qn8u0qtvQ2799227992eucas1p27; Wed, 21 Jun 2023 08:38:27 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230621083827eusmtrp2c2782f3198b3fa03d1bb09a40cf6c73f~qn8u0FFW40288202882eusmtrp2n; Wed, 21 Jun 2023 08:38:27 +0000 (GMT) X-AuditID: cbfec7f2-25927a800002a5b7-93-6492b703aa1d Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 4B.8B.14344.307B2946; Wed, 21 Jun 2023 09:38:27 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230621083827eusmtip239f1c51b1230f7e64d3e672ac51768e8~qn8uq2k3_0773907739eusmtip22; Wed, 21 Jun 2023 08:38:27 +0000 (GMT) Received: from localhost (106.110.32.140) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 21 Jun 2023 09:38:26 +0100 From: Pankaj Raghav To: , , CC: , , , , , , Pankaj Raghav Subject: [RFC 2/4] filemap: use minimum order while allocating folios Date: Wed, 21 Jun 2023 10:38:21 +0200 Message-ID: <20230621083823.1724337-3-p.raghav@samsung.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621083823.1724337-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Originating-IP: [106.110.32.140] X-ClientProxiedBy: CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) To CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) X-Brightmail-Tracker: H4sIAAAAAAAAA02Sf0yMcRzHfZ/n6bmn42lPd9FnUXJjUio34Ugk5JDNj8T8k1NPaa6r3ZX8 ijslOqJdfswpWvltXd1dnVLRD8dSGkucX2E6qsmms0lt0vWw9d/r/X2/39v7s30pXHDBxYtK UqSxSoVMLiL5hOXR7/ZA/K4uft554wJJ5aMuJKkr0WGSW3esmORl2ylMUlffQkg67hWSElu+ HUmGBwvJcEr6pASk5pv+UtPtXFJa+1pNSs2tB6UOk89Gcgd/aTwrT9rLKoOX7eTvtl8eJFLv +e1ztH9FatTnq0WuFDAhUKxpxrSITwmYmwi6TZ9JTvxE8KqljHSmBIwDQV1xwv9GxadKFy50 A4HjgwFxYjQ0XPGBx4lKBC+thYQWURTJ+IMml+dsezDhYDYWjrVxpg5Bg2YAcxpCZjVUPcsj nEwws6D8Ys5Yl2ZCocGgdCIw06H0IzgTrsxSMN5qRE6mGXdoudg91sRHI1lVl3COARp7enBu tAjU5jaC40yoz2oYmwnMCAXV2iIXzlgFnY1ZPI6F0Pe48h9Pg5GaKxjHB8FuG8a5cjaCMzXl JD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9llI2mchaV/AyLyKUSS1tDg3PbfYSK84Mbe4NC9dLzk/dxMjMDK3Hfu5ZQfjylcf9Q4x MnEwHmKU4GBWEuGV3TQpRYg3JbGyKrUoP76oNCe1+BCjKdCXE5mlRJPzgakhryTe0MzA1NDE zNLA1NLMWEmc17OgI1FIID2xJDU7NbUgtQimj4mDU6qBae/L6W9T1wbu3uCwYNr/ZQ4BNyO1 LQ8wbLL8k5l0rT99ddz/r6sF446+/NF6q3vurennH0e+dvtz48SCsh6B0mm3407ObT77yjH2 svm6SE3e4zdUTgp9uzntoc/G59s3SnQmtpp/v9NZ1623pvP7tyuzTtcX86qkik1i3K80waTz 7/rVPF+b3n2aJSi1v/9HtNIMe8fp00Rmeehk/PZereLMxqCygLV5buT1iWoncjNV+R5ut7nX 1fL33rOb+3Su3zg/+6jiR5Xs63v63wY+fP3o3AHRs/N2qK+wmPvvCqNIfpX9oq4DO9R+BPnq WCyN/r/t2L/T113aufYJcjc9nxxlsntir0ick9u1RQcOLajuV2Ipzkg01GIuKk4EAByVAs1V AwAA X-CMS-MailID: 20230621083827eucas1p2948b4efaf55064c3761c924b5b049219 X-Msg-Generator: CA X-RootMTR: 20230621083827eucas1p2948b4efaf55064c3761c924b5b049219 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230621083827eucas1p2948b4efaf55064c3761c924b5b049219 References: <20230621083823.1724337-1-p.raghav@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Add support to filemap and readahead to use the folio order set by mapping_min_folio_order(). Signed-off-by: Pankaj Raghav --- mm/filemap.c | 9 ++++++--- mm/readahead.c | 34 ++++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 3b73101f9f86..9dc8568e9336 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1936,7 +1936,8 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index, gfp |= GFP_NOWAIT | __GFP_NOWARN; } - folio = filemap_alloc_folio(gfp, 0); + folio = filemap_alloc_folio(gfp, + mapping_min_folio_order(mapping)); if (!folio) return ERR_PTR(-ENOMEM); @@ -2495,7 +2496,8 @@ static int filemap_create_folio(struct file *file, struct folio *folio; int error; - folio = filemap_alloc_folio(mapping_gfp_mask(mapping), 0); + folio = filemap_alloc_folio(mapping_gfp_mask(mapping), + mapping_min_folio_order(mapping)); if (!folio) return -ENOMEM; @@ -3663,7 +3665,8 @@ static struct folio *do_read_cache_folio(struct address_space *mapping, repeat: folio = filemap_get_folio(mapping, index); if (IS_ERR(folio)) { - folio = filemap_alloc_folio(gfp, 0); + folio = filemap_alloc_folio(gfp, + mapping_min_folio_order(mapping)); if (!folio) return ERR_PTR(-ENOMEM); err = filemap_add_folio(mapping, folio, index, gfp); diff --git a/mm/readahead.c b/mm/readahead.c index 47afbca1d122..090b810ddeed 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -245,7 +245,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, @@ -259,7 +260,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; } /* @@ -311,6 +313,8 @@ void force_page_cache_ra(struct readahead_control *ractl, struct file_ra_state *ra = ractl->ra; struct backing_dev_info *bdi = inode_to_bdi(mapping->host); unsigned long max_pages, index; + unsigned int folio_order = mapping_min_folio_order(mapping); + unsigned int nr_of_pages = (1 << folio_order); if (unlikely(!mapping->a_ops->read_folio && !mapping->a_ops->readahead)) return; @@ -320,6 +324,13 @@ void force_page_cache_ra(struct readahead_control *ractl, * be up to the optimal hardware IO size */ index = readahead_index(ractl); + if (folio_order && (index & (nr_of_pages - 1))) { + unsigned long old_index = index; + + index = round_down(index, nr_of_pages); + nr_to_read += (old_index - index); + } + max_pages = max_t(unsigned long, bdi->io_pages, ra->ra_pages); nr_to_read = min_t(unsigned long, nr_to_read, max_pages); while (nr_to_read) { @@ -795,18 +806,20 @@ void readahead_expand(struct readahead_control *ractl, struct file_ra_state *ra = ractl->ra; pgoff_t new_index, new_nr_pages; gfp_t gfp_mask = readahead_gfp_mask(mapping); + unsigned min_folio_count = 1U << mapping_min_folio_order(mapping); - new_index = new_start / PAGE_SIZE; + new_index = new_start / (min_folio_count * PAGE_SIZE); /* Expand the leading edge downwards */ while (ractl->_index > new_index) { - unsigned long index = ractl->_index - 1; + unsigned long index = ractl->_index - min_folio_count; struct folio *folio = xa_load(&mapping->i_pages, index); if (folio && !xa_is_value(folio)) return; /* Folio apparently present */ - folio = filemap_alloc_folio(gfp_mask, 0); + folio = filemap_alloc_folio(gfp_mask, + mapping_min_folio_order(mapping)); if (!folio) return; if (filemap_add_folio(mapping, folio, index, gfp_mask) < 0) { @@ -818,7 +831,7 @@ void readahead_expand(struct readahead_control *ractl, ractl->_workingset = true; psi_memstall_enter(&ractl->_pflags); } - ractl->_nr_pages++; + ractl->_nr_pages += folio_nr_pages(folio); ractl->_index = folio->index; } @@ -833,7 +846,8 @@ void readahead_expand(struct readahead_control *ractl, if (folio && !xa_is_value(folio)) return; /* Folio apparently present */ - folio = filemap_alloc_folio(gfp_mask, 0); + folio = filemap_alloc_folio(gfp_mask, + mapping_min_folio_order(mapping)); if (!folio) return; if (filemap_add_folio(mapping, folio, index, gfp_mask) < 0) { @@ -845,10 +859,10 @@ void readahead_expand(struct readahead_control *ractl, ractl->_workingset = true; psi_memstall_enter(&ractl->_pflags); } - ractl->_nr_pages++; + ractl->_nr_pages += folio_nr_pages(folio); if (ra) { - ra->size++; - ra->async_size++; + ra->size += folio_nr_pages(folio); + ra->async_size += folio_nr_pages(folio); } } } From patchwork Wed Jun 21 08:38:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 13286860 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4092EEB64D8 for ; Wed, 21 Jun 2023 08:38:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231624AbjFUIiw (ORCPT ); Wed, 21 Jun 2023 04:38:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231283AbjFUIih (ORCPT ); Wed, 21 Jun 2023 04:38:37 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C21511992 for ; Wed, 21 Jun 2023 01:38:32 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230621083829euoutp02325356fd8167dec1da65e553e046c9bd~qn8worH4-0616906169euoutp02F for ; Wed, 21 Jun 2023 08:38:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230621083829euoutp02325356fd8167dec1da65e553e046c9bd~qn8worH4-0616906169euoutp02F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1687336709; bh=rvlCjmlSj0ZGDPQ/cfO6o7K+JkKYO3ZTGRL/HoVyZkI=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=f2JlsmvJy5R+KQPw6npTXW8J/LIQM+eqasPWHqsIdpw4VsYHEJpK2LFXezG0dSkjT q8vsQSXLnfIryKjUcE6SgPFYh+Zvb92L5FG3y/AIec5k7o1ixkQXeiPJGnEjbO3I9D MEzSOpdlpSZKORrgYnMbYyTdLqw/22c3TN92wZIY= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230621083829eucas1p11b550c4838bc9fe93c75dfe0fa9c602a~qn8wTQQ8a2120721207eucas1p1i; Wed, 21 Jun 2023 08:38:29 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id A2.2A.42423.507B2946; Wed, 21 Jun 2023 09:38:29 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230621083828eucas1p23222cae535297f9536f12dddd485f97b~qn8v_yb723008730087eucas1p2o; Wed, 21 Jun 2023 08:38:28 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230621083828eusmtrp23eb1aa29cb9f11352d3e19ee81f3649c~qn8v_Luwr0288202882eusmtrp2p; Wed, 21 Jun 2023 08:38:28 +0000 (GMT) X-AuditID: cbfec7f2-a51ff7000002a5b7-98-6492b705af31 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id DC.8B.14344.407B2946; Wed, 21 Jun 2023 09:38:28 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230621083828eusmtip268aebe9ddef3dfc67b9f54483d98e7da~qn8v0A8p-2785727857eusmtip29; Wed, 21 Jun 2023 08:38:28 +0000 (GMT) Received: from localhost (106.110.32.140) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 21 Jun 2023 09:38:28 +0100 From: Pankaj Raghav To: , , CC: , , , , , , Pankaj Raghav Subject: [RFC 3/4] block: set mapping order for the block cache in set_init_blocksize Date: Wed, 21 Jun 2023 10:38:22 +0200 Message-ID: <20230621083823.1724337-4-p.raghav@samsung.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621083823.1724337-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Originating-IP: [106.110.32.140] X-ClientProxiedBy: CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) To CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprJKsWRmVeSWpSXmKPExsWy7djPc7qs2yelGHSs47TYcuweo8WeRZOY LFauPspkce1MD5PFnr0nWSwu75rDZnFjwlNGi98/5rA5cHicWiThsXmFlsemVZ1sHrtvNrB5 bD5d7fF5k1wAWxSXTUpqTmZZapG+XQJXxq+bd1kKHnBVLN6ymKmB8QdHFyMnh4SAiUT3rH9s XYxcHEICKxglVrzoYgNJCAl8YZRY/5UVIvGZUeL1+kmsMB0z75yA6ljOKPHi/jtmuKoVl/6z QzhbGCUafk5l6mLk4GAT0JJo7GQH6RYRcJDYvHEO2FhmgT2MEgcaPzGBJIQFwiW+7u1gBrFZ BFQlllxcC7aOV8Ba4vPp7WBzJATkJRY/kAAJcwrYSGxceZARokRQ4uTMJywgNjNQSfPW2cwQ toTEwRcvmCGuVpJo2HyGBcKulTi15RYTyA0SAj84JI6tX8wIkXCRWHbzCBOELSzx6vgWdghb RuL/zvlQ8WqJpzd+M0M0tzBK9O9czwZxnLVE35kciBpHickLj7FAhPkkbrwVhLiHT2LStunM EGFeiY42oQmMKrOQfDALyQezkHywgJF5FaN4amlxbnpqsWFearlecWJucWleul5yfu4mRmDq Of3v+KcdjHNffdQ7xMjEwXiIUYKDWUmEV3bTpBQh3pTEyqrUovz4otKc1OJDjNIcLErivNq2 J5OFBNITS1KzU1MLUotgskwcnFINTNKdO9a8j1SoUL0YWPNf327yMekJa1SmWKwXTzOS0w78 c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Z/nvZVqNuNF3 /YysmordjYd3ZejwVv+bpBju4Bjg8umTdIy+U/P7NAHt+pSSu7bessfWTlqk+cpj/d/Pp17s yPLM21z3bNuHiHwOnrJpRxWn9199EV/+yfXyrm5Ned3pdeyCXpPtfhjWaO2ambJtWs7KfVE6 bEman68/YGFzTuXab9gQ7HL30+34/GWaUYKvv7Ik/9e4aHukzuSIVZ+usun7Vc7zr174H9A0 d3PUnh+MBVKLp0u5ik54LhMzUy07z3nXkwRuk/hZp/gD2vKcnF4Wnex261xwRc5V9KTnNvbs 07mly3cYzn2sp6i1ZemjP6p35l7Pddm+WpW/7urfIEGRJCWW4oxEQy3mouJEAKd6m0hWAwAA X-CMS-MailID: 20230621083828eucas1p23222cae535297f9536f12dddd485f97b X-Msg-Generator: CA X-RootMTR: 20230621083828eucas1p23222cae535297f9536f12dddd485f97b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230621083828eucas1p23222cae535297f9536f12dddd485f97b References: <20230621083823.1724337-1-p.raghav@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Luis Chamberlain Automatically set the minimum mapping order for block devices in set_init_blocksize(). The mapping order will be set only when the block device uses iomap based aops. Signed-off-by: Pankaj Raghav Signed-off-by: Luis Chamberlain --- block/bdev.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/block/bdev.c b/block/bdev.c index 9bb54d9d02a6..db8cede8a320 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -126,6 +126,7 @@ static void set_init_blocksize(struct block_device *bdev) { unsigned int bsize = bdev_logical_block_size(bdev); loff_t size = i_size_read(bdev->bd_inode); + int order, folio_order; while (bsize < PAGE_SIZE) { if (size & bsize) @@ -133,6 +134,14 @@ static void set_init_blocksize(struct block_device *bdev) bsize <<= 1; } bdev->bd_inode->i_blkbits = blksize_bits(bsize); + order = bdev->bd_inode->i_blkbits - PAGE_SHIFT; + folio_order = mapping_min_folio_order(bdev->bd_inode->i_mapping); + + if (!IS_ENABLED(CONFIG_BUFFER_HEAD)) { + /* Do not allow changing the folio order after it is set */ + WARN_ON_ONCE(folio_order && (folio_order != order)); + mapping_set_folio_orders(bdev->bd_inode->i_mapping, order, 31); + } } int set_blocksize(struct block_device *bdev, int size) From patchwork Wed Jun 21 08:38:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 13286859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A8AEEB64DD for ; Wed, 21 Jun 2023 08:38:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231468AbjFUIik (ORCPT ); Wed, 21 Jun 2023 04:38:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231166AbjFUIie (ORCPT ); Wed, 21 Jun 2023 04:38:34 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E35B01987 for ; Wed, 21 Jun 2023 01:38:31 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230621083830euoutp01ca7fb32929a659a61cbca89136261bd1~qn8xsrZWW0952109521euoutp01d for ; Wed, 21 Jun 2023 08:38:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230621083830euoutp01ca7fb32929a659a61cbca89136261bd1~qn8xsrZWW0952109521euoutp01d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1687336710; bh=w3WwCWATNZEjaxwXuvbzceRiaECoMo+kjp6czj94BZw=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=remuJAmv++xqADP0gSs92HnGKNaq2Ho0RzPzXAS95cXG0eJ+EuGJMr82vRUFpGnqH PlvAA6Ic4ui13UwsZLbo91cHjWy2OqIF438t8BDSv3y7C0d+2JQfpMIxRXr1wjyDwP uQPkjq2R/KCz2OQ+s3bAH8ML05vGiljTTO6QIiOE= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230621083830eucas1p1bd1ed8b55bf02cbf0607171ae098f2fa~qn8xbeCsy1887218872eucas1p1g; Wed, 21 Jun 2023 08:38:30 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id A3.2A.42423.607B2946; Wed, 21 Jun 2023 09:38:30 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230621083830eucas1p1c7e6ea9e23949a9688aac6f9f3ea25fb~qn8xMmChV2120721207eucas1p1m; Wed, 21 Jun 2023 08:38:30 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230621083830eusmtrp2960ddc217a12ea8b2ff7b9919f63eca4~qn8xL3wm80284602846eusmtrp2J; Wed, 21 Jun 2023 08:38:30 +0000 (GMT) X-AuditID: cbfec7f2-a3bff7000002a5b7-9d-6492b706ee14 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 1F.8B.14344.607B2946; Wed, 21 Jun 2023 09:38:30 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230621083829eusmtip28a5341bf537b3783377d1c6eea202609~qn8w_T4Qh2282222822eusmtip2R; Wed, 21 Jun 2023 08:38:29 +0000 (GMT) Received: from localhost (106.110.32.140) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 21 Jun 2023 09:38:29 +0100 From: Pankaj Raghav To: , , CC: , , , , , , Pankaj Raghav Subject: [RFC 4/4] nvme: enable logical block size > PAGE_SIZE Date: Wed, 21 Jun 2023 10:38:23 +0200 Message-ID: <20230621083823.1724337-5-p.raghav@samsung.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621083823.1724337-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Originating-IP: [106.110.32.140] X-ClientProxiedBy: CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) To CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) X-Brightmail-Tracker: H4sIAAAAAAAAA02Se0hTYRjG+845Ox4Xs9MS9mppMbphpRldVpZkRc0/yqjoBpVLT2rO5c60 m1QbLtPRZayFpnZTqmVXNzNXGjqaZq0IK1lXSp2aGJGKKYPM+SX43/M+z+/le174GFKcLwhm UlQZHK9SKKW0kKqsH3w9j35kSpzfbQ6SVdR/RbLqEhMhu3XbSciaXacJWXVNIyV7+7iYlrmN HiTzDhTTKxn5ixKQ2yxhcmtZHi1/8kFLy20vs+S91tCN9E7h8kROmXKQ4yOi44XJFUVGMr2V PvzGfh5pUa3AgPwZYBdC0zszMiAhI2YtCBpcDgEe+hBcemoaocRsL4IP1yaMbnh1nwgM3URw Xa+j8DAMdZQU0nioQDBg6x9OGIZmw0CX5+fbDmRXgq28eOQJkq1GUKvrIXzMJDYaSk+qfZJi Z8Bzw0EfLmKjoE17289nAzsVSr+Bz/Znl0P5rTqEkYnQeLGN8mlyGMl+WERiDVDX2UnizlLQ 2lwU1segJrvWz9cA2CEGLrZYEA7WQLfT/V9Pgq6GCj+sp8CQ/QqBdRZ43F4SL+sRnLPfp3G5 KDjrUmImBspaSwlsB4D750TcJwBMlfkktkWQmy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n525iBMbltmM/t+xgXPnqo94h RiYOxkOMEhzMSiK8spsmpQjxpiRWVqUW5ccXleakFh9iNAX6ciKzlGhyPjAx5JXEG5oZmBqa mFkamFqaGSuJ83oWdCQKCaQnlqRmp6YWpBbB9DFxcEo1MOlv2Vyv2GHbs3Zt/RulTu7lz2xL rURk7194rm1+/GyJbdPvPw6s7zbk3pnbvOzl3vuqKUWzL/ZGquc83z9BiaEkTfEt3+uUosjJ Z4OuV89aueSeRWLqqYly6fqfTs1hZw742h9V5mHE88LZR0kvurKW/UBT3irGt/M/FoSfmc0+ xeLsjMlzJYU1rO02/50/x5wrfq/QrsgzTjnfCu+0+Wp//FISdHnJzOd6339vtDt1Il9LdPXm rH0Ly5K7lt4Wnel9ou2kkKjZZHelOeaOFh4yT159vJXAtvVuktf6H1cvCETKn737MyFDgNnj bGGcfSE/+7o5WX+2s87aI5gpedq/Yb37vh9zGV+un7nsnagSS3FGoqEWc1FxIgC+fEt3VAMA AA== X-CMS-MailID: 20230621083830eucas1p1c7e6ea9e23949a9688aac6f9f3ea25fb X-Msg-Generator: CA X-RootMTR: 20230621083830eucas1p1c7e6ea9e23949a9688aac6f9f3ea25fb X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230621083830eucas1p1c7e6ea9e23949a9688aac6f9f3ea25fb References: <20230621083823.1724337-1-p.raghav@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Don't set the capacity to zero for when logical block size > PAGE_SIZE as the block device with iomap aops support allocating block cache with a minimum folio order. Signed-off-by: Pankaj Raghav --- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 98bfb3d9c22a..36cf610f938c 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1886,7 +1886,7 @@ static void nvme_update_disk_info(struct gendisk *disk, * The block layer can't support LBA sizes larger than the page size * yet, so catch this early and don't allow block I/O. */ - if (ns->lba_shift > PAGE_SHIFT) { + if ((ns->lba_shift > PAGE_SHIFT) && IS_ENABLED(CONFIG_BUFFER_HEAD)) { capacity = 0; bs = (1 << 9); }