Re: [PATCH v8 12/15] filemap: Remove checks in mapping_set_folio_order_range()
[email protected] Tue, 4 Aug 2026 00:01:01 -0700
| Newsgroups | gmane.linux.file-systems,gmane.linux.kernel.mm |
|---|---|
| Message-ID | <[email protected]> |
On 7/31/2026 1:07 PM, Matthew Wilcox (Oracle) wrote: > These checks make it impossible to use mapping_set_folio_order_range()=20 > in hugetlb. They add very little value and can simply be removed.=20 > Signed-off-by: Matthew Wilcox (Oracle) <willy@=E2=80=8Ainfradead.=E2=80= =8Aorg> ---=20 > include/linux/pagemap.=E2=80=8Ah | 34 ++++++++++++++-------------------- >=20 >=20 > These checks make it impossible to use mapping_set_folio_order_range() > in hugetlb. They add very little value and can simply be removed. >=20 > Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> > --- > include/linux/pagemap.h | 34 ++++++++++++++-------------------- > 1 file changed, 14 insertions(+), 20 deletions(-) >=20 > 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 addres= s_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 addres= s_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_support= ed(void) > * @min: Minimum folio order (between 0-MAX_PAGECACHE_ORDER inclusive). > * @max: Maximum folio order (between @min-MAX_PAGECACHE_ORDER inclusiv= e). > * > - * 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 =3D MAX_PAGECACHE_ORDER; > - > - if (max > MAX_PAGECACHE_ORDER) > - max =3D MAX_PAGECACHE_ORDER; > - > if (max < min) > max =3D min; > =20 > @@ -460,7 +454,7 @@ static inline void mapping_set_large_folios(struct ad= dress_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_MA= X; > } > @@ -468,7 +462,7 @@ mapping_max_folio_order(const struct address_space *m= apping) > 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_MI= N; > } > @@ -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 */ > --=20 > 2.47.3 >=20 Nice. Reviewed-by: Jane Chu <[email protected]> thanks, -jane