From patchwork Wed Jan 10 09:21:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13515844 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 A9D88C47073 for ; Wed, 10 Jan 2024 09:21:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3ABE46B0075; Wed, 10 Jan 2024 04:21:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 35C836B0078; Wed, 10 Jan 2024 04:21:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 186E26B0092; Wed, 10 Jan 2024 04:21:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 083016B0075 for ; Wed, 10 Jan 2024 04:21:39 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D7BD5A03C1 for ; Wed, 10 Jan 2024 09:21:38 +0000 (UTC) X-FDA: 81662858676.14.299D554 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf20.hostedemail.com (Postfix) with ESMTP id 419261C0018 for ; Wed, 10 Jan 2024 09:21:37 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=VvT59FfZ; spf=none (imf20.hostedemail.com: domain of BATV+17e9c08914743a4dbb9f+7444+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+17e9c08914743a4dbb9f+7444+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704878497; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=vemtm26RZJwq2BkJen0DsgudNpnNIQOHTlEDhkpMTMQ=; b=YAOwvqR8aZ8H2fGefun2ihgqaR/zrRf2zv5NX3QQ/ODkD52uPfShdNfloa8YVC5NiaK1ts dmXM0X2d5ZHgXftdBf1q34KopDaXrwKW+KQzRtT2TsWtSqwW4TcIsTZ1iu2Cbr2CWmszmT G9JKfmfdQhtsYw3LvEUW1rwdQypb1Qs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704878497; a=rsa-sha256; cv=none; b=rSKssbca89Ix0s+R/AfMHjp8quJm1OcpZrTqXOK2CvxO5lcRI0n75UOyaaeB+aDoJPgWTz ZcznQQdrzkquu6QH9lnpp9NFxnj3qgpmyPKznXPEYT6HOmK1RzVIHG1+8Nw39pxiaxbszk F2PZYBndpiGwimnoV0T5KaDp7/MFOsU= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=VvT59FfZ; spf=none (imf20.hostedemail.com: domain of BATV+17e9c08914743a4dbb9f+7444+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+17e9c08914743a4dbb9f+7444+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=vemtm26RZJwq2BkJen0DsgudNpnNIQOHTlEDhkpMTMQ=; b=VvT59FfZyGViQ4E9bybilVlr/n E58xcBMqiG7yHbZRyzY+MeZqOUO73LE+/oyqen6J0wutWRO0UD5OylhJ4Mqx1GoUwrpWkQ9ockMTO zyTTGC4l3K2AVsMneNh/767/v9arpPkmZu6jv9Kpv6xyiCQwY2IKXC2f87wwmXRPgcGR0L6ncNvtJ bRz65LMjl5Yq3e1j5b56u9hCiLVBySWQ/Sr/aid4EvqC/7O7zhvFA590kdpkdOalJHAgkUUs+n+Vw EHaNxwv8+03GiryNOsM8jEJ2KcP9yx6govhS285icE+S4S6N7L/QIGjZIj5ny8VRfIkY7q9yV3/yB MgyUdYOw==; Received: from [2001:4bb8:191:2f6b:27f:45ef:e74a:3466] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rNUlv-00AsAi-1t; Wed, 10 Jan 2024 09:21:16 +0000 From: Christoph Hellwig To: Matthew Wilcox , Hugh Dickins , Chandan Babu R Cc: "Darrick J . Wong" , Andrew Morton , David Howells , Jarkko Sakkinen , Dave Hansen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Christian Koenig , Huang Rui , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, x86@kernel.org, linux-sgx@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, keyrings@vger.kernel.org Subject: [PATCH 1/2] mm: add a mapping_clear_large_folios helper Date: Wed, 10 Jan 2024 10:21:08 +0100 Message-Id: <20240110092109.1950011-2-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240110092109.1950011-1-hch@lst.de> References: <20240110092109.1950011-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: 419261C0018 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: gjsdkknthnkawmfw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p1wKuWx5LE9zq0vjmaa5dRtg8TpsGkyVbkX18gR6Wn2RwwRQw3R7HHdedzS9t48yV4lr7SEuVF3eMDyEjwOOcrUEYR4lthBXQ48OfuyKMmXV05QLn1HlzlWrmIpi7z4E0KkCJWWzmQMn5IGqbnS42gjgMdf1cIs1EmcG/W2pqu/LmeFSHZ6kRSd+JU/bQnhyYw8/d4NXuM3nsSH3L/ERl2OPFpPOOJ1iAqsRXG0/EQcK+wE1zMn1jbWbUmdQszFsf2aclRin3YTg5VCBsHChsnEguoN9r2d1NnDkmAhiAFFNDnP4FKSwB9WHAlsscZnDpdQCSquwQlablVBk5wzcB+58WVlfHEaO+23495QabhU5OqW+dJcDxQkkR4ZLDR4i3TLuL6mw7slp3t4vUa1oW7DdAEJHSAju30A5YTo/ckVhP2Pp9A== 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: Users of shmem_kernel_file_setup might not be able to deal with large folios (yet). Give them a way to disable large folio support on their mapping. Signed-off-by: Christoph Hellwig --- include/linux/pagemap.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 06142ff7f9ce0e..352d1f8423292c 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -343,6 +343,20 @@ static inline void mapping_set_large_folios(struct address_space *mapping) __set_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags); } +/** + * mapping_clear_large_folios() - Disable large folio support for a mapping + * @mapping: The mapping. + * + * This can be called to undo the effect of mapping_set_large_folios(). + * + * Context: This should not be called while the inode is active as it + * is non-atomic. + */ +static inline void mapping_clear_large_folios(struct address_space *mapping) +{ + __clear_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags); +} + /* * Large folio support currently depends on THP. These dependencies are * being worked on but are not yet fixed. From patchwork Wed Jan 10 09:21:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13515845 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 42C37C3DA6E for ; Wed, 10 Jan 2024 09:21:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 46ECD6B0078; Wed, 10 Jan 2024 04:21:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FA206B0092; Wed, 10 Jan 2024 04:21:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 162656B0093; Wed, 10 Jan 2024 04:21:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0431B6B0078 for ; Wed, 10 Jan 2024 04:21:40 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D38661C14EF for ; Wed, 10 Jan 2024 09:21:39 +0000 (UTC) X-FDA: 81662858718.08.C7F16DA Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf27.hostedemail.com (Postfix) with ESMTP id 3E1B640006 for ; Wed, 10 Jan 2024 09:21:37 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Dg3kbq00; dmarc=none; spf=none (imf27.hostedemail.com: domain of BATV+17e9c08914743a4dbb9f+7444+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+17e9c08914743a4dbb9f+7444+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704878497; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=SRlTQ4JibYJcOmgh50kWG725LphAqsA74nKJKgMAVp4=; b=U7K3xe800zlYlTNIx6+nGjh/NSgD/yB78Fi1I6lr3P/Ck/9wnhc/i1g9EaLuqQWl3en6A7 EP/pk6EnKoQvt71rX8nj/zOsel0SBVc1K8qjmMnHPDCcmkiQc4z/LMtQq0Rn6a7w8cc49W iDuBWp86kgL9bzD9x2ZNCLJBSiu3iN4= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Dg3kbq00; dmarc=none; spf=none (imf27.hostedemail.com: domain of BATV+17e9c08914743a4dbb9f+7444+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+17e9c08914743a4dbb9f+7444+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704878497; a=rsa-sha256; cv=none; b=p0UeUGRYrgZRIfoIAz5yzN7THhMkDqYplYJE4D9lbrwX5jf831aXRwUj0g8kUBxn9Qq1AP NC8ekaYy8OON6CYDbVu1eCTKiGpiMKcryC8/JHiBJJqAefICJaNfmGebKlproQ5hOR7LRE YDtsyoaXvExKxkwfw9P9GKvIQeepWXM= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=SRlTQ4JibYJcOmgh50kWG725LphAqsA74nKJKgMAVp4=; b=Dg3kbq00hAKG9Jac9pBCT8H0hY gQ8Pe7mzKNIEig0gdVS8L1YQm0lhILIpgErWpRQQhhUxLv9H0RVqQ3mwJIZgCK71qmej5Pzo80Gdc esoiR5D75fIZEZkE2YGIQ0nRjdBJgj5NgoZ0u6hyM5l308ERxwn5zQS37wJOuDp3WVhw9DmbPux0P jbkJFK7k3ROEFnFSjfok+rePV67Oo3t8DURPYH89imUH1WfUTjQEQmy1GSAcXWYC8OlDc8YzNDXUE PvxJ1Yxm5WtS8mPmLMaHV4I181FWwxPbMxc4CbckfiLDECitlWA61LzaC24kAJ/8WbYHany1t520v wVR5xXoQ==; Received: from [2001:4bb8:191:2f6b:27f:45ef:e74a:3466] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rNUly-00AsAw-0n; Wed, 10 Jan 2024 09:21:18 +0000 From: Christoph Hellwig To: Matthew Wilcox , Hugh Dickins , Chandan Babu R Cc: "Darrick J . Wong" , Andrew Morton , David Howells , Jarkko Sakkinen , Dave Hansen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Christian Koenig , Huang Rui , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, x86@kernel.org, linux-sgx@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, keyrings@vger.kernel.org Subject: [PATCH 2/2] xfs: disable large folio support in xfile_create Date: Wed, 10 Jan 2024 10:21:09 +0100 Message-Id: <20240110092109.1950011-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240110092109.1950011-1-hch@lst.de> References: <20240110092109.1950011-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 3E1B640006 X-Stat-Signature: whz1c57h5hnw8otff55x4mkqj86ciij8 X-Rspam-User: X-HE-Tag: 1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MtAe3S00R9LOyvPBsslFDr4T0fKIRKvhqSVdfi8ScoiqjynHc9p4SNjtr/4hLAo7qQuf/jbvJpOXeVRSpz911Tiq0q0usC3/vNxUsTubAEsvNujq1D8kGWaTtg9AEqrR1yGgV/H+UgOfzMGYUml/bifbJU2rPxGB2+/QTn3eyNqw/UVflrJI5e6z+K+gE4gAVgIxIos306Pzh/BsT07KH9U9YGCH1ijnr/h4ziUlSqCCNdRqu9zQZnBRsdym6JA7Z/Cd7zoAFtnwH7ijvFFRueUl3mrMAX1/IW5cg8qJhkA3Pz5sB16TGTJ8pnQzUtR5Py7VM5IZ/OIkMfZ5nR2MwfCtZb1KAsdE9vNjXXi0MkJydNNQ5mmSFx7yErDZofZDecb2agjfm619an2usNqH7xvAza6kGmHNrE4QTj9w//JcZQjtqKFE/7qoxwtIFo4= 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: The xfarray code will crash if large folios are force enabled using: echo force > /sys/kernel/mm/transparent_hugepage/shmem_enabled Fixing this will require a bit of an API change, and prefeably sorting out the hwpoison story for pages vs folio and where it is placed in the shmem API. For now use this one liner to disable large folios. Reported-by: Darrick J. Wong Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong --- fs/xfs/scrub/xfile.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/xfs/scrub/xfile.c b/fs/xfs/scrub/xfile.c index 090c3ead43fdf1..1a8d1bedd0b0dc 100644 --- a/fs/xfs/scrub/xfile.c +++ b/fs/xfs/scrub/xfile.c @@ -94,6 +94,11 @@ xfile_create( lockdep_set_class(&inode->i_rwsem, &xfile_i_mutex_key); + /* + * We're not quite ready for large folios yet. + */ + mapping_clear_large_folios(inode->i_mapping); + trace_xfile_create(xf); *xfilep = xf;