diff mbox series

[v2,04/28] fs: Rename AS_THP_SUPPORT and mapping_thp_support

Message ID 20211108040551.1942823-5-willy@infradead.org (mailing list archive)
State New, archived
Headers show
Series iomap/xfs folio patches | expand

Commit Message

Matthew Wilcox Nov. 8, 2021, 4:05 a.m. UTC
These are now indicators of multi-page folio support, not THP support.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/pagemap.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Christoph Hellwig Nov. 9, 2021, 8:41 a.m. UTC | #1
On Mon, Nov 08, 2021 at 04:05:27AM +0000, Matthew Wilcox (Oracle) wrote:
> These are now indicators of multi-page folio support, not THP support.

Given that we don't use the large foltio term anywhere else this really
needs to grow a comment explaining what the flag means.
Matthew Wilcox Nov. 15, 2021, 4:03 p.m. UTC | #2
On Tue, Nov 09, 2021 at 12:41:19AM -0800, Christoph Hellwig wrote:
> On Mon, Nov 08, 2021 at 04:05:27AM +0000, Matthew Wilcox (Oracle) wrote:
> > These are now indicators of multi-page folio support, not THP support.
> 
> Given that we don't use the large foltio term anywhere else this really
> needs to grow a comment explaining what the flag means.

I think I prefer the term 'large' to 'multi'.  What would you think to
this patch (not on top of any particular branch; just to show the scope
of it ...)

+++ b/include/linux/page-flags.h
@@ -692,7 +692,7 @@ static inline bool folio_test_single(struct folio *folio)
        return !folio_test_head(folio);
 }

-static inline bool folio_test_multi(struct folio *folio)
+static inline bool folio_test_large(struct folio *folio)
 {
        return folio_test_head(folio);
 }
+++ b/mm/filemap.c
@@ -192,9 +192,9 @@ static void filemap_unaccount_folio(struct address_space *mapping,
        __lruvec_stat_mod_folio(folio, NR_FILE_PAGES, -nr);
        if (folio_test_swapbacked(folio)) {
                __lruvec_stat_mod_folio(folio, NR_SHMEM, -nr);
-               if (folio_test_multi(folio))
+               if (folio_test_large(folio))
                        __lruvec_stat_mod_folio(folio, NR_SHMEM_THPS, -nr);
-       } else if (folio_test_multi(folio)) {
+       } else if (folio_test_large(folio)) {
                __lruvec_stat_mod_folio(folio, NR_FILE_THPS, -nr);
                filemap_nr_thps_dec(mapping);
        }
@@ -236,7 +236,7 @@ void filemap_free_folio(struct address_space *mapping, struct folio *folio)
        if (freepage)
                freepage(&folio->page);

-       if (folio_test_multi(folio) && !folio_test_hugetlb(folio)) {
+       if (folio_test_large(folio) && !folio_test_hugetlb(folio)) {
                folio_ref_sub(folio, folio_nr_pages(folio));
                VM_BUG_ON_FOLIO(folio_ref_count(folio) <= 0, folio);
        } else {
+++ b/mm/memcontrol.c
@@ -5558,7 +5558,7 @@ static int mem_cgroup_move_account(struct page *page,

        VM_BUG_ON(from == to);
        VM_BUG_ON_FOLIO(folio_test_lru(folio), folio);
-       VM_BUG_ON(compound && !folio_test_multi(folio));
+       VM_BUG_ON(compound && !folio_test_large(folio));

        /*
         * Prevent mem_cgroup_migrate() from looking at
Christoph Hellwig Nov. 16, 2021, 6:33 a.m. UTC | #3
On Mon, Nov 15, 2021 at 04:03:22PM +0000, Matthew Wilcox wrote:
> I think I prefer the term 'large' to 'multi'.  What would you think to
> this patch (not on top of any particular branch; just to show the scope
> of it ...)

I don't really care either way. Just be consistent and maybe add a
comment here and there..
diff mbox series

Patch

diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 471f0c422831..2ad10e1fd224 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -34,7 +34,7 @@  enum mapping_flags {
 	AS_EXITING	= 4, 	/* final truncate in progress */
 	/* writeback related tags are not used */
 	AS_NO_WRITEBACK_TAGS = 5,
-	AS_THP_SUPPORT = 6,	/* THPs supported */
+	AS_LARGE_FOLIO_SUPPORT = 6,
 };
 
 /**
@@ -139,12 +139,12 @@  static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
  */
 static inline void mapping_set_large_folios(struct address_space *mapping)
 {
-	__set_bit(AS_THP_SUPPORT, &mapping->flags);
+	__set_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags);
 }
 
-static inline bool mapping_thp_support(struct address_space *mapping)
+static inline bool mapping_large_folio_support(struct address_space *mapping)
 {
-	return test_bit(AS_THP_SUPPORT, &mapping->flags);
+	return test_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags);
 }
 
 static inline int filemap_nr_thps(struct address_space *mapping)
@@ -159,7 +159,7 @@  static inline int filemap_nr_thps(struct address_space *mapping)
 static inline void filemap_nr_thps_inc(struct address_space *mapping)
 {
 #ifdef CONFIG_READ_ONLY_THP_FOR_FS
-	if (!mapping_thp_support(mapping))
+	if (!mapping_large_folio_support(mapping))
 		atomic_inc(&mapping->nr_thps);
 #else
 	WARN_ON_ONCE(1);
@@ -169,7 +169,7 @@  static inline void filemap_nr_thps_inc(struct address_space *mapping)
 static inline void filemap_nr_thps_dec(struct address_space *mapping)
 {
 #ifdef CONFIG_READ_ONLY_THP_FOR_FS
-	if (!mapping_thp_support(mapping))
+	if (!mapping_large_folio_support(mapping))
 		atomic_dec(&mapping->nr_thps);
 #else
 	WARN_ON_ONCE(1);