From: jane.chu@oracle.com
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org
Cc: Muchun Song <muchun.song@linux.dev>,
Oscar Salvador <osalvador@suse.de>,
David Hildenbrand <david@kernel.org>,
Miaohe Lin <linmiaohe@huawei.com>,
Naoya Horiguchi <nao.horiguchi@gmail.com>,
Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org,
Christian Brauner <christian@brauner.io>,
Jiaqi Yan <jiaqiyan@google.com>
Subject: Re: [PATCH v8 12/15] filemap: Remove checks in mapping_set_folio_order_range()
Date: Tue, 4 Aug 2026 00:01:01 -0700 [thread overview]
Message-ID: <a5ea2f04-7f4b-49ba-a26d-a493ebfc67f2@oracle.com> (raw)
In-Reply-To: <20260731200802.574821-13-willy@infradead.org>
On 7/31/2026 1:07 PM, Matthew Wilcox (Oracle) wrote:
> These checks make it impossible to use mapping_set_folio_order_range()
> in hugetlb. They add very little value and can simply be removed.
> Signed-off-by: Matthew Wilcox (Oracle) <willy@ infradead. org> ---
> include/linux/pagemap. h | 34 ++++++++++++++--------------------
>
>
> These checks make it impossible to use mapping_set_folio_order_range()
> in hugetlb. They add very little value and can simply be removed.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> include/linux/pagemap.h | 34 ++++++++++++++--------------------
> 1 file changed, 14 insertions(+), 20 deletions(-)
>
> diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
> index 2c3718d592d6..968b791cfd14 100644
> --- a/include/linux/pagemap.h
> +++ b/include/linux/pagemap.h
> @@ -373,7 +373,7 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
> * assumptions about maximum order if THP are disabled, but 8 seems like
> * a good order (that's 1MB if you're using 4kB pages)
> */
> -#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> +#ifdef CONFIG_LARGE_FOLIO
> #define PREFERRED_MAX_PAGECACHE_ORDER HPAGE_PMD_ORDER
> #else
> #define PREFERRED_MAX_PAGECACHE_ORDER 8
> @@ -394,7 +394,7 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
> */
> static inline size_t mapping_max_folio_size_supported(void)
> {
> - if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
> + if (IS_ENABLED(CONFIG_LARGE_FOLIO))
> return 1U << (PAGE_SHIFT + MAX_PAGECACHE_ORDER);
> return PAGE_SIZE;
> }
> @@ -405,29 +405,23 @@ static inline size_t mapping_max_folio_size_supported(void)
> * @min: Minimum folio order (between 0-MAX_PAGECACHE_ORDER inclusive).
> * @max: Maximum folio order (between @min-MAX_PAGECACHE_ORDER inclusive).
> *
> - * The filesystem should call this function in its inode constructor to
> - * indicate which base size (min) and maximum size (max) 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).
> + * The filesystem should call this function in its inode constructor
> + * to indicate which size folios can be used to cache the contents of
> + * the inode. 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.
> *
> + * hugetlb calls this with orders larger than MAX_PAGECACHE_ORDER.
> + * Normal filesystems should not do this.
> + *
> * Context: This should not be called while the inode is active as it
> * is non-atomic.
> */
> static inline void mapping_set_folio_order_range(struct address_space *mapping,
> - unsigned int min,
> - unsigned int max)
> + unsigned int min, unsigned int max)
> {
> - if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
> + if (!IS_ENABLED(CONFIG_LARGE_FOLIO))
> return;
> -
> - if (min > MAX_PAGECACHE_ORDER)
> - min = MAX_PAGECACHE_ORDER;
> -
> - if (max > MAX_PAGECACHE_ORDER)
> - max = MAX_PAGECACHE_ORDER;
> -
> if (max < min)
> max = min;
>
> @@ -460,7 +454,7 @@ static inline void mapping_set_large_folios(struct address_space *mapping)
> static inline unsigned int
> mapping_max_folio_order(const struct address_space *mapping)
> {
> - if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
> + if (!IS_ENABLED(CONFIG_LARGE_FOLIO))
> return 0;
> return (mapping->flags & AS_FOLIO_ORDER_MAX_MASK) >> AS_FOLIO_ORDER_MAX;
> }
> @@ -468,7 +462,7 @@ mapping_max_folio_order(const struct address_space *mapping)
> static inline unsigned int
> mapping_min_folio_order(const struct address_space *mapping)
> {
> - if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
> + if (!IS_ENABLED(CONFIG_LARGE_FOLIO))
> return 0;
> return (mapping->flags & AS_FOLIO_ORDER_MIN_MASK) >> AS_FOLIO_ORDER_MIN;
> }
> @@ -524,7 +518,7 @@ static inline bool mapping_large_folio_support(const struct address_space *mappi
> *
> * Return: True if PMD-sized folios are supported, otherwise false.
> */
> -#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> +#ifdef CONFIG_LARGE_FOLIO
> static inline bool mapping_pmd_folio_support(const struct address_space *mapping)
> {
> /* AS_FOLIO_ORDER is only reasonable for pagecache folios */
> --
> 2.47.3
>
Nice.
Reviewed-by: Jane Chu <jane.chu@oracle.com>
thanks,
-jane
next prev parent reply other threads:[~2026-08-04 7:06 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 20:07 [PATCH v8 00/15] Use generic_file_read_iter() in hugetlbfs Matthew Wilcox (Oracle)
2026-07-31 20:07 ` [PATCH v8 01/15] memory-failure: Fix hardware poison check in unpoison_memory() again Matthew Wilcox (Oracle)
2026-07-31 20:07 ` [PATCH v8 02/15] memory-failure: Prevent hugetlb freeing during unpoisoning Matthew Wilcox (Oracle)
2026-08-04 6:40 ` jane.chu
2026-08-04 15:35 ` Matthew Wilcox
2026-08-04 21:22 ` jane.chu
2026-07-31 20:07 ` [PATCH v8 03/15] mm: Rename folio_contain_hwpoison_page() to folio_has_hwpoison_page() Matthew Wilcox (Oracle)
2026-07-31 20:07 ` [PATCH v8 04/15] hugetlb: Mark some function arguments as const Matthew Wilcox (Oracle)
2026-08-04 6:41 ` jane.chu
2026-07-31 20:07 ` [PATCH v8 05/15] guest_memfd: Use folio_has_hwpoisoned_page() Matthew Wilcox (Oracle)
2026-08-04 6:42 ` jane.chu
2026-07-31 20:07 ` [PATCH v8 06/15] kpageflags: Use is_page_hwpoison() to set KPF_HWPOISON Matthew Wilcox (Oracle)
2026-08-04 6:44 ` jane.chu
2026-08-04 15:46 ` Matthew Wilcox
2026-08-04 20:21 ` jane.chu
2026-08-04 16:13 ` Gregory Price
2026-07-31 20:07 ` [PATCH v8 07/15] hugetlb: Move poison to pages before clearing hugetlb page type Matthew Wilcox (Oracle)
2026-08-04 6:47 ` jane.chu
2026-07-31 20:07 ` [PATCH v8 08/15] hugetlb: Use the has_hwpoisoned flag Matthew Wilcox (Oracle)
2026-08-04 6:51 ` jane.chu
2026-08-04 16:04 ` Matthew Wilcox
2026-08-04 16:28 ` Gregory Price
2026-08-04 16:42 ` Matthew Wilcox
2026-08-04 18:43 ` Gregory Price
2026-07-31 20:07 ` [PATCH v8 09/15] mm: Remove locking mf_mutex in is_raw_hwpoison_page_in_hugepage() Matthew Wilcox (Oracle)
2026-08-04 6:56 ` jane.chu
2026-08-04 16:36 ` Gregory Price
2026-08-04 16:58 ` Matthew Wilcox
2026-08-04 18:47 ` Gregory Price
2026-08-04 20:32 ` jane.chu
2026-07-31 20:07 ` [PATCH v8 10/15] mm: Check individual hugetlb pages for poison Matthew Wilcox (Oracle)
2026-08-04 6:59 ` jane.chu
2026-08-04 19:15 ` Gregory Price
2026-08-04 21:21 ` Matthew Wilcox
2026-08-04 23:01 ` Gregory Price
2026-07-31 20:07 ` [PATCH v8 11/15] filemap: Add hwpoison handling to filemap_read() Matthew Wilcox (Oracle)
2026-07-31 20:07 ` [PATCH v8 12/15] filemap: Remove checks in mapping_set_folio_order_range() Matthew Wilcox (Oracle)
2026-08-04 7:01 ` jane.chu [this message]
2026-08-04 21:23 ` Gregory Price
2026-08-05 3:28 ` Matthew Wilcox
2026-07-31 20:07 ` [PATCH v8 13/15] hugetlb: Set mapping folio order Matthew Wilcox (Oracle)
2026-08-04 7:01 ` jane.chu
2026-07-31 20:07 ` [PATCH v8 14/15] filemap: Add support for authoritative mappings Matthew Wilcox (Oracle)
2026-08-04 7:02 ` jane.chu
2026-07-31 20:08 ` [PATCH v8 15/15] hugetlb: replace hugetlbfs_read_iter() with generic_file_read_iter() Matthew Wilcox (Oracle)
2026-08-04 21:26 ` Gregory Price
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=a5ea2f04-7f4b-49ba-a26d-a493ebfc67f2@oracle.com \
--to=jane.chu@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=christian@brauner.io \
--cc=david@kernel.org \
--cc=jack@suse.cz \
--cc=jiaqiyan@google.com \
--cc=linmiaohe@huawei.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=nao.horiguchi@gmail.com \
--cc=osalvador@suse.de \
--cc=willy@infradead.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