From: Christoph Hellwig <hch@lst.de>
To: Matthew Wilcox <willy@infradead.org>,
Hugh Dickins <hughd@google.com>,
Chandan Babu R <chandan.babu@oracle.com>
Cc: "Darrick J . Wong" <djwong@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
David Howells <dhowells@redhat.com>,
Jarkko Sakkinen <jarkko@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Christian Koenig <christian.koenig@amd.com>,
Huang Rui <ray.huang@amd.com>,
Jani Nikula <jani.nikula@linux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
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 [thread overview]
Message-ID: <20240110092109.1950011-2-hch@lst.de> (raw)
In-Reply-To: <20240110092109.1950011-1-hch@lst.de>
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 <hch@lst.de>
---
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.
--
2.39.2
next prev parent reply other threads:[~2024-01-10 9:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 9:21 disable large folios for shmem file used by xfs xfile Christoph Hellwig
2024-01-10 9:21 ` Christoph Hellwig [this message]
2024-01-10 9:21 ` [PATCH 2/2] xfs: disable large folio support in xfile_create Christoph Hellwig
2024-01-10 17:55 ` Darrick J. Wong
2024-01-10 20:04 ` Darrick J. Wong
2024-01-11 22:00 ` Andrew Morton
2024-01-11 22:45 ` Matthew Wilcox
2024-01-12 2:22 ` Darrick J. Wong
2024-02-08 1:56 ` Andrew Morton
2024-02-08 16:03 ` Darrick J. Wong
2024-01-10 12:37 ` disable large folios for shmem file used by xfs xfile Matthew Wilcox
2024-01-10 15:20 ` Joonas Lahtinen
2024-01-10 15:28 ` Joonas Lahtinen
2024-01-10 15:34 ` Matthew Wilcox
2024-01-11 21:30 ` Daniel Gomez
2024-01-10 16:18 ` Christoph Hellwig
[not found] ` <20240110073843.d663fa6610785a8611b2cebe@linux-foundation.org>
2024-01-10 16:19 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240110092109.1950011-2-hch@lst.de \
--to=hch@lst.de \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=chandan.babu@oracle.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dave.hansen@linux.intel.com \
--cc=dhowells@redhat.com \
--cc=djwong@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hughd@google.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jarkko@kernel.org \
--cc=joonas.lahtinen@linux.intel.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-sgx@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=ray.huang@amd.com \
--cc=rodrigo.vivi@intel.com \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=tzimmermann@suse.de \
--cc=willy@infradead.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox