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: 110870 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4217690vqr; Wed, 21 Jun 2023 01:55:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5g1Mv3VHLDtzxTDQHX9v+NXbeJ4cKj/Z1Lkbtt3p8FrYywKebxrf1me9sbDOEnTfz8WR5x X-Received: by 2002:a05:6214:260f:b0:628:6ed3:109f with SMTP id gu15-20020a056214260f00b006286ed3109fmr17394634qvb.27.1687337725717; Wed, 21 Jun 2023 01:55:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687337725; cv=none; d=google.com; s=arc-20160816; b=YaLjHFuqu/5U9wLgzV5c5Q2Ix2WUbpYIhItGsBSm1nQ96Ad1YLXv+FE7d64t4GZ86V azyo0zhB9b0J2KkAfh8jD5muZVbsK0kwZmFeTS9SfGZOtz4m/KoPY8d3zJynU8qu64tf fX3LnWmlJ7q9m4QB4WzJE5f11laalrgziduyF4AaWMo72g4/8ePvadiXRJ7Ojgf/LlIx 2ffUEWfJN/T9KXrgxOC30WBv278IZ2SdHdyds8X1/WpIu2sgcokv4yEZ/5AD1esSDKPZ 3Smk7bGJQY5tOb2RodxHTeSHrj5xz8C4ENGNx4SzIioG2+QwO6+3bx8n9W3bWq4a4739 hsOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=p+ceLN5ku7io/26SFBn3OjERPGRRlK1fZyar/4zm1hE=; b=zQbVzAz+2l6B0Ja1b5Du0nM/uiKbrTMK8buzlJ4/hiWWUfslmAIa4BrdZEK6XDKTCZ TxQonCOd4oHhnRF9FHI2uYBmOeJxx6AcUXhMubGUKj4PnkzGi+RViff1CuFQTiZbBFwG nBLgkNxhYwtQ0z5tBZbBDYfuo5PSTI6B4oKqgSg4yD+XYR7C7AYOkdJz9Youepqf6ZBx zadYyJJ0GQ+KEERNBioo5CDI78cal2hmUBdKjxYTtoiwTqMIVdXbdmR6oEZW5oqaWMss cg8+2QEVVP/ah6sLNhiU6PRk1kKiZL8nq7a9NDgM4L1bj/enu1MGRsRcE6ydF1e1k7JZ +B0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Pbg9tlpu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l70-20020a638849000000b005340840c0c8si3781866pgd.327.2023.06.21.01.54.47; Wed, 21 Jun 2023 01:55:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Pbg9tlpu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231453AbjFUIii (ORCPT + 99 others); Wed, 21 Jun 2023 04:38:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230361AbjFUIib (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 D36BE10FB 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 20230621083827euoutp0206790a86bb20aa861c5cbb6e116a233c~qn8uhW9330633206332euoutp02F for ; Wed, 21 Jun 2023 08:38:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230621083827euoutp0206790a86bb20aa861c5cbb6e116a233c~qn8uhW9330633206332euoutp02F 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/ RM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MKLY9NqzrZPHbfbGDz 2Hy62uPzJrkAtig9m6L80pJUhYz84hJbpWhDCyM9Q0sLPSMTSz1DY/NYKyNTJX07m5TUnMyy 1CJ9uwS9jN2nj7AWTJapmLNxDlsD4ybxLkZODgkBE4kHm36wdDFycQgJLGWUmDmhlx0iISOx 8ctVVghbWOLPtS42iKKPjBLXpj9lAkkICWxhlFh/s7yLkYODTUBLorETrFdEwEFi88Y5rCD1 zAJ7GCUONH4CqxcGSuzZegOsiEVAVaJ5bScbiM0rYC1x4u4lVpA5EgLyEosfSICEOQVsJDau PMgIscpaov34VHaIckGJkzOfsIDYzEDlzVtnM0PYEhIHX7xghrhZSaJh8xkWCLtW4vPfZ4wT GEVmIWmfhaR9FpL2BYzMqxhFUkuLc9Nziw31ihNzi0vz0vWS83M3MQIjc9uxn5t3MM579VHv ECMTB+MhRgkOZiURXtlNk1KEeFMSK6tSi/Lji0pzUosPMZoCvTmRWUo0OR+YGvJK4g3NDEwN TcwsDUwtzYyVxHk9CzoShQTSE0tSs1NTC1KLYPqYODilGpj2PCussruv7/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> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769301843122881946?= X-GMAIL-MSGID: =?utf-8?q?1769301843122881946?= 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: 110868 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4217220vqr; Wed, 21 Jun 2023 01:54:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ48WHu/pVgXxg8iVSu7xMMB/127xAGf0YwwFqXaotx416xz+RG533jMZ3NsXsAtgaqRfDyu X-Received: by 2002:a05:6a00:844:b0:668:8c7a:47e2 with SMTP id q4-20020a056a00084400b006688c7a47e2mr7581887pfk.19.1687337651849; Wed, 21 Jun 2023 01:54:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687337651; cv=none; d=google.com; s=arc-20160816; b=xO+V4loJ5Mj4U6wMtsVFOCEgJbBAZtO1YXro5c4A8eINsjpVPLmT9fvzGs4AZiNsBs 9sduXMtqFb43QnTyxB49tDPCQQMqRnLr+++KDoAILlkdnVluJ5JVX29DIBvUQF4BBkmt NT5pCqOzmnO6e7oU1GR9oQ0xpScfqczqN1eZ0XmwoBYSEpqAFpliItmID27okSDpzD50 rlHyaNUcTNIWRm722dvo2FZRT1Twp+xZyH1WzceDdj5kC357w1YR3KfX0PKxNpkw00l5 L2vd4dkwXRKZouRZpq88GnCrDqMx3Vcnq1AZPSvmz+NrCLtqeH974tQOSww5x8sPUvqF qLWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=p3mOYJ8f1hVTCexaglZ7i/L8HoJqlurEbyVlQliHZdg=; b=RvTmjHlNsY0cO8DUcbl4+WrQDbyqQ5UGB8/HdYRU1U6leRzb6bpj0Tp1r7+EHcdPGq rUMQUnHULxCFu1Dqk6J1qGjk6jQVsdYXMQME9SJoZP7veZVl6Ym2uWibGNkd+Zw2vACB bXT3fsWjCHcYMEdwOkEHuRwh0VFNB04NHl+kC7bPN5/W988RPgQzzHWQV13woOMFF7cu RpaTrsjIwao9z0t4JkHvmCyz2Ou2OQOuGChQH2IPLEVh6kfq028tDofm5toSDoyaDqp9 DoDCEEY5QC5Pu96XghDmLh2IHiVmTnG0scohBXJKn2MNDs/lJJNK+BZQpGR07Tj8UZGj 04ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=RaplaNf1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020a056a00138a00b0066a4a09645dsi258533pfg.254.2023.06.21.01.53.56; Wed, 21 Jun 2023 01:54:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=RaplaNf1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231532AbjFUIin (ORCPT + 99 others); Wed, 21 Jun 2023 04:38:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231144AbjFUIic (ORCPT ); Wed, 21 Jun 2023 04:38:32 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A1601985 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 20230621083828euoutp024463c9171911deeb7e614a267002b777~qn8vVwdiJ0615706157euoutp02E for ; Wed, 21 Jun 2023 08:38:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230621083828euoutp024463c9171911deeb7e614a267002b777~qn8vVwdiJ0615706157euoutp02E 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/K4uft554wJJ5a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KeMFr9/zGFz4PA4tUjCY/MKLY9NqzrZPHbfbGDz 2Hy62uPzJrkAtig9m6L80pJUhYz84hJbpWhDCyM9Q0sLPSMTSz1DY/NYKyNTJX07m5TUnMyy 1CJ9uwS9jKfzfrAU7NKo+HzuOWMD4yuFLkZODgkBE4kND7ewdjFycQgJLGWUaPy0iQUiISOx 8ctVVghbWOLPtS42iKKPjBLdy14yQThbGCX+PjoM1MHBwSagJdHYyQ7SICLgILF54xywqcwC exglDjR+YgJJCAu4Smy90Au2gUVAVWL9zDawXl4Ba4kD64pATAkBeYnFDyRAKjgFbCQ2rjzI CGILAVW0H58KNp5XQFDi5MwnYFOYgcqbt85mhrAlJA6+eMEMcbOSRMPmM1C/1Ep0vjrNNoFR ZBaS9llI2mchaV/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> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769301765597613440?= X-GMAIL-MSGID: =?utf-8?q?1769301765597613440?= 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: 110861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4213609vqr; Wed, 21 Jun 2023 01:44:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6lYGC7pUTgSOGOR+cLHpbIw+eqmCiIfdzkG0QjPxVNFcZUuBmv5wUufMiequuqU+EbwpVH X-Received: by 2002:a17:90b:17d0:b0:256:ae6c:fd1f with SMTP id me16-20020a17090b17d000b00256ae6cfd1fmr19512884pjb.20.1687337052024; Wed, 21 Jun 2023 01:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687337052; cv=none; d=google.com; s=arc-20160816; b=u7MSpQje12iV6JIatA+jA8H6eplson0pVQ267xJ1s9WvjTtLmTtiEVwQYj3WFHrb35 Xs+FTA/QpBpWerECteTTS8rvoHwsKybQyoNZJIvygm5Tw5/WX8TwzRRrEIPHhYTEvwg7 +Oxb7SuYgwXMYIk2TtmFODdUZvKED7TTmc/WsuPTc78Zll06yr3XCqRYedpZ3d+mUe2G ZNZmIo9VWTpkvNE0QNUsOQ6PLCk9Kkf2E1BKUTkYnJ4QULPggLnFW28/sETj4TMKZi7z 6/sYh+zAfxWgFP1O+P0A1SGxj0/GvQ30jUByvHy19PeBTCk+9Yp9mACdnh0Uex29k8VL vLEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=rvlCjmlSj0ZGDPQ/cfO6o7K+JkKYO3ZTGRL/HoVyZkI=; b=OzQuFhC0tF6PuesUQmWsa3Z5+w11m0/az4sQSjIMf7m4XTSQ+eViTRHGvywYI7/0EI qy6xLoMlC1YXc/zjSdLytfy0StMqV49sl/k5eJ40gR8vFZB0SCOiWR1D/XiXxYUa32Mg AXe9+yIlsAN6qR2cdB7zXyHybKMDN5foetLIViB8ySuRkCXB8qVuSccZZUKS5LkqyVpA Eyxku7WTZGd1ETiwVnXbdIIHd8y9SeOy9q/6LsJD6jTmN6xgZjO69RMWY52mt2/J+ZUq vvKaTwQcZG4j2jKqH0/yNYHht33oEPfWfUoMWb0s83CuLSyd1qZp/vZidkh8Gm5ZSVgP Wvng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=f2JlsmvJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x8-20020a17090aca0800b00256610c2765si3532384pjt.125.2023.06.21.01.43.55; Wed, 21 Jun 2023 01:44:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=f2JlsmvJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231577AbjFUIir (ORCPT + 99 others); Wed, 21 Jun 2023 04:38:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231253AbjFUIig (ORCPT ); Wed, 21 Jun 2023 04:38:36 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C201C1991 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 20230621083829euoutp029746c7d7e3312b1aff21ec47418dee55~qn8wpEp9u0634806348euoutp024 for ; Wed, 21 Jun 2023 08:38:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230621083829euoutp029746c7d7e3312b1aff21ec47418dee55~qn8wpEp9u0634806348euoutp024 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 toTEwRcvmCGuVpJo2HyGBcKulTi15RYTyA0SAj84JI6tX8wIkXCRWHbzCBOELSzx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jsXHl QUYQWwiopP34VHaIckGJkzOfsIDYzEDlzVtnM0PYEhIHX7xghjhaSaJh8xkWCLtW4vPfZ4wT GEVmIWmfhaR9FpL2BYzMqxhFUkuLc9Nzi430ihNzi0vz0vWS83M3MQJjc9uxn1t2MK589VHv ECMTB+MhRgkOZiURXtlNk1KEeFMSK6tSi/Lji0pzUosPMZoCvTmRWUo0OR+YHPJK4g3NDEwN TcwsDUwtzYyVxHk9CzoShQTSE0tSs1NTC1KLYPqYODilGpg4Wvpy73+b5FlWZ/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> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769301136387350343?= X-GMAIL-MSGID: =?utf-8?q?1769301136387350343?= 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: 110871 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4217869vqr; Wed, 21 Jun 2023 01:55:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4XdPN0fjiqj+p6aNIYW4idZLvfw9TYJVlYk6QDth6P5NIY0DQ+wXHMz9q/mp9XG554zeAw X-Received: by 2002:a05:620a:2043:b0:762:43c0:b97b with SMTP id d3-20020a05620a204300b0076243c0b97bmr12754840qka.43.1687337753283; Wed, 21 Jun 2023 01:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687337753; cv=none; d=google.com; s=arc-20160816; b=h09t0bSClgtU5HGlRbQ5XqLA7mqEn1QBe+8iteu7/bTdjC2jj7pYS1Y39aEqdgaMZO J27jfgJ25hu6V3fUd9l+EfT4+jwP/7T337ZY2NehXK9rpNd5okrqw80+9oHUd8QYkoy6 QhH7xj/2+MG4uAYlTc7sK3AqeBC5Zo26awiluO3GWQjXGxAuhqZohbOaH9698HOofnnJ DqSCmCCjIsVoXtAFIuzohnsEbN3hlJjRWNUjhQa5XZLwHYMf1Q1qgyc3w3EXQfOpyAdg gi4/YmpPybiJcE2+uphw5oqUldzwxCWwvUDPB/pp9CsBurljVyMm8DbULomuhbKvFqBG WP8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=w3WwCWATNZEjaxwXuvbzceRiaECoMo+kjp6czj94BZw=; b=Nl++7qUWQ2+TjGA4enRnf+Dzv2qXlsyGuoLmsQ1JSwDSblhZoQFC6WqVnrW+F/n6k+ dYZIMtNlgB8hLeFYQ6VldeqfeP5p3PtsQZvACVAnChLII1gf0ae2Rpy+OKMwhJK/VQPT HdQTH1HQxuEQdbmVffWz1+UBWt3leRS1JNHTkFsUlSADW2u2xVkHoFg/OWNO/0x179+2 yvK5ERjWj7JGwMfwsGJUKgmcB7zN0G5EoSmaxyrLNJ+bsTkqda3J/j/QauBRNqXItVnw o8cs2yjvNpA8CH0Asj819WpMKhEndDJHsaM4h06mIpvAdoJNZkk44EjYbKucTSYB93oA Wh5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=remuJAmv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020a056a00138a00b0066a4a09645dsi258533pfg.254.2023.06.21.01.55.34; Wed, 21 Jun 2023 01:55:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=remuJAmv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231140AbjFUIiy (ORCPT + 99 others); Wed, 21 Jun 2023 04:38:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231298AbjFUIih (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 2BC1E1995 for ; Wed, 21 Jun 2023 01:38:33 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230621083830euoutp02ef327c5b62ff82e73717719369184214~qn8xstjp_0588605886euoutp02L for ; Wed, 21 Jun 2023 08:38:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230621083830euoutp02ef327c5b62ff82e73717719369184214~qn8xstjp_0588605886euoutp02L 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+WERiD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wp4CNxMaV BxlBbCGgkvbjU9khygUlTs58AnYmM1B589bZzBC2hMTBFy+YIU5WkmjYfAbqlVqJzlen2SYw isxC0j4LSfssJO0LGJlXMYqklhbnpucWG+kVJ+YWl+al6yXn525iBMbltmM/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> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769301872237217571?= X-GMAIL-MSGID: =?utf-8?q?1769301872237217571?= 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); }