mm: Fix READ_ONLY_THP warning
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 10 Oct 2020 15:47:55 +0000 (11:47 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 21 Mar 2022 17:01:36 +0000 (13:01 -0400)
These counters only exist if CONFIG_READ_ONLY_THP_FOR_FS is defined,
but we do not need to warn if the filesystem natively supports large
folios.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
include/linux/pagemap.h

index a73c928..0a2417f 100644 (file)
@@ -326,7 +326,7 @@ static inline void filemap_nr_thps_inc(struct address_space *mapping)
        if (!mapping_large_folio_support(mapping))
                atomic_inc(&mapping->nr_thps);
 #else
-       WARN_ON_ONCE(1);
+       WARN_ON_ONCE(mapping_large_folio_support(mapping) == 0);
 #endif
 }
 
@@ -336,7 +336,7 @@ static inline void filemap_nr_thps_dec(struct address_space *mapping)
        if (!mapping_large_folio_support(mapping))
                atomic_dec(&mapping->nr_thps);
 #else
-       WARN_ON_ONCE(1);
+       WARN_ON_ONCE(mapping_large_folio_support(mapping) == 0);
 #endif
 }