From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21CAEC3DA41 for ; Tue, 9 Jul 2024 08:12:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A16A36B009A; Tue, 9 Jul 2024 04:12:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9C6AA6B009D; Tue, 9 Jul 2024 04:12:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 88E716B009E; Tue, 9 Jul 2024 04:12:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6BCFD6B009A for ; Tue, 9 Jul 2024 04:12:00 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 05BF21217B2 for ; Tue, 9 Jul 2024 08:12:00 +0000 (UTC) X-FDA: 82319496000.28.9D63FC8 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf05.hostedemail.com (Postfix) with ESMTP id CF2FD10000E for ; Tue, 9 Jul 2024 08:11:57 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720512703; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WlCUdr0GGvVS96dr/+I25IL8r4DH63npL5kZoM3csq8=; b=k4bvxxlpbvvMeFT3h25uTfyIoGl6vBGDBCYZYl1bc2468qgRX2nKAu0D+ihcO7jItWqi7S yNI3AjoInjkFXVZrTeHoJUIz6X3XdSEvo1MNWYHjRyeZUcNXB3gc1HKkfAwaX2YJHKHNXo yUzAA3XKGmnhjD8pxsc8SXj3jRWdEgA= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720512703; a=rsa-sha256; cv=none; b=BKVaA6A8zqpdl2cTPNPxZ3JYrjRV5TnoNrvxnHKekvcQevMk9RXxPPOiFzujzPYL+ELUzI T65IrZ+ovPwiFtqweJi7OX9IIVlF+9/S1r2x5TVLPb+q4YE6AAio9B96/EoZ5BlJcMawCT dD7TTEKuAHRYg0lKWuP7qpEp6idCWRA= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CBAE81042; Tue, 9 Jul 2024 01:12:21 -0700 (PDT) Received: from [10.57.76.194] (unknown [10.57.76.194]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2AA763F762; Tue, 9 Jul 2024 01:11:53 -0700 (PDT) Message-ID: <5875f5ea-4d83-4691-914c-15834338410e@arm.com> Date: Tue, 9 Jul 2024 09:11:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 01/10] fs: Allow fine-grained control of folio sizes Content-Language: en-GB To: Dave Chinner Cc: "Pankaj Raghav (Samsung)" , Matthew Wilcox , chandan.babu@oracle.com, djwong@kernel.org, brauner@kernel.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, yang@os.amperecomputing.com, linux-mm@kvack.org, john.g.garry@oracle.com, linux-fsdevel@vger.kernel.org, hare@suse.de, p.raghav@samsung.com, mcgrof@kernel.org, gost.dev@samsung.com, cl@os.amperecomputing.com, linux-xfs@vger.kernel.org, hch@lst.de, Zi Yan References: <20240625114420.719014-1-kernel@pankajraghav.com> <20240625114420.719014-2-kernel@pankajraghav.com> <20240705132418.gk7oeucdisat3sq5@quentin> <1e0e89ea-3130-42b0-810d-f52da2affe51@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: CF2FD10000E X-Stat-Signature: xut8j8nkxggejtnx687xdrb8oj8a4mfk X-HE-Tag: 1720512717-357656 X-HE-Meta: U2FsdGVkX18qdGS7H1OzVsRiVYz5J3y41MpfYCNp4510vqzYBf+BFHli3YxUhjVXFLn4HSiTIutpA33qWJBx510FWoUH2HCxeYBkw9HnjjlokR9vgtdlR7wfzq0+Vs0hOS2gF//vEar9AFZMv1X2zu/ByVMgZ7qDlDs8y+eZMXtYlKEa3Dc/+1wt5EFwndCJ0uKZ2BfAhEH0qgEA9/yIPQTu3Flv278EosN6HEV9S2Ihj0SXH2oIuGc6N39HRJmT6HS0IKv6SmqAanuRe2NL/XrejrgOdLEvyc9pMsnIXuNZFFijDNcfGXrGQhrCZwOIxPJCyhNfBsbEar7fBRFnpuXRxNnjS6M1z2A5+9nAIPPkmRlaPm2zDWNBA9XHfQRTQT7VBQansoArtlRd8oKqi+VHDEOI749xhJvOeRfnJfk5Rz+FSEj4Q+77gcJRiDqWQgpk4nMxx3hBK6g4gnLORiNUMbBZDwFzpzOu1TF1LCH+lVAjmwop9yawvyG80A2VxfVlMBMPLfHkMUQrFCJsmzC2Dca+xtIzb/+1bf0VOua6g28vqsbJpqcgQXdPUwTccsZO1XlaiajqwC0dNyZJLIFxA40mY2onEl/LtMwMs3tBOHjnhRUOlUuiHPeImgYzsIyosNemP0dAQjH42pG1w87hHe2byH48IgPkbJGFLwdGZk9thYPaOyFAWxuOoApgqqwgrgbau3DYwB2SW7XwpfkzaW4jQbADtZoiyKC9F77PX4/h0dS2oF4dd5lQrtWCOz799kLU3I0AG8xsw9s55T7+BduGlYCUUHtzAhyvrp81O7HceMOcba2U2Hw20TpXyNzpHzVqmqHufuZMRHkNUnOUVLcr+qO5uxsqXXaVGNXivE6k8bfslQET/M4AUxFEfp+6wC3RWFeH7V1TNAbyOvi2f10dwnkQ9GjPDBRKiIHtf71EnbelLReYv6yv9NUSVhUAUPpANZM5M3+iuVQ hLmjbTNf Z3GSA0GRRjqIdHJz18N4yoHh0d3q+4c0K+0VDLAQFbRIwIZWViZrpBHaGZGr40EcUCV4hulErJBcNeArrmwLmdnoAjxZ8ajZdhiDyzBO6AMsXcNSYXKl+IYgTq9dDUXEUB+Z9cb0pNE/I8ZwEWTtzSqjxfw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 09/07/2024 00:01, Dave Chinner wrote: > On Fri, Jul 05, 2024 at 02:31:08PM +0100, Ryan Roberts wrote: >> On 05/07/2024 14:24, Pankaj Raghav (Samsung) wrote: >>>>> I suggest you handle it better than this. If the device is asking for a >>>>> blocksize > PMD_SIZE, you should fail to mount it. >>>> >>>> That's my point: we already do that. >>>> >>>> The largest block size we support is 64kB and that's way smaller >>>> than PMD_SIZE on all platforms and we always check for bs > ps >>>> support at mount time when the filesystem bs > ps. >>>> >>>> Hence we're never going to set the min value to anything unsupported >>>> unless someone makes a massive programming mistake. At which point, >>>> we want a *hard, immediate fail* so the developer notices their >>>> mistake immediately. All filesystems and block devices need to >>>> behave this way so the limits should be encoded as asserts in the >>>> function to trigger such behaviour. >>> >>> I agree, this kind of bug will be encountered only during developement >>> and not during actual production due to the limit we have fs block size >>> in XFS. >>> >>>> >>>>> If the device is >>>>> asking for a blocksize > PAGE_SIZE and CONFIG_TRANSPARENT_HUGEPAGE is >>>>> not set, you should also decline to mount the filesystem. >>>> >>>> What does CONFIG_TRANSPARENT_HUGEPAGE have to do with filesystems >>>> being able to use large folios? >>>> >>>> If that's an actual dependency of using large folios, then we're at >>>> the point where the mm side of large folios needs to be divorced >>>> from CONFIG_TRANSPARENT_HUGEPAGE and always supported. >>>> Alternatively, CONFIG_TRANSPARENT_HUGEPAGE needs to selected by the >>>> block layer and also every filesystem that wants to support >>>> sector/blocks sizes larger than PAGE_SIZE. IOWs, large folio >>>> support needs to *always* be enabled on systems that say >>>> CONFIG_BLOCK=y. >>> >>> Why CONFIG_BLOCK? I think it is enough if it comes from the FS side >>> right? And for now, the only FS that needs that sort of bs > ps >>> guarantee is XFS with this series. Other filesystems such as bcachefs >>> that call mapping_set_large_folios() only enable it as an optimization >>> and it is not needed for the filesystem to function. >>> >>> So this is my conclusion from the conversation: >>> - Add a dependency in Kconfig on THP for XFS until we fix the dependency >>> of large folios on THP >> >> THP isn't supported on some arches, so isn't this effectively saying XFS can no >> longer be used with those arches, even if the bs <= ps? > > I'm good with that - we're already long past the point where we try > to support XFS on every linux platform. Indeed, we've recent been > musing about making XFS depend on 64 bit only - 32 bit systems don't > have the memory capacity to run the full xfs tool chain (e.g. > xfs_repair) on filesystems over about a TB in size, and they are > greatly limited in kernel memory and vmap areas, both of which XFS > makes heavy use of. Basically, friends don't let friends use XFS on > 32 bit systems, and that's been true for about 20 years now. > > Our problem is the test matrix - if we now have to explicitly test > XFS both with and without large folios enabled to support these > platforms, we've just doubled our test matrix. The test matrix is > already far too large to robustly cover, so anything that requires > doubling the number of kernel configs we have to test is, IMO, a > non-starter. > > That's why we really don't support XFS on 32 bit systems anymore and > why we're talking about making that official with a config option. > If we're at the point where XFS will now depend on large folios (i.e > THP), then we need to seriously consider reducing the supported > arches to just those that support both 64 bit and THP. If niche > arches want to support THP, or enable large folios without the need > for THP, then they can do that work and then they get XFS for > free. > > Just because an arch might run a Linux kernel, it doesn't mean we > have to support XFS on it.... OK. I was just pointing out the impact of adding this Kconfig dependency. If that impact is explicitly considered and desired, then great. I'll leave you to it. Thanks, Ryan > > -Dave.