diff mbox series

[for,mm-unstable,2/3] mm/shmem: Use folio_test_transhuge() for THP check

Message ID 20220504200758.314478-3-sj@kernel.org (mailing list archive)
State New
Headers show
Series Fix build errors due to folio_test_large() misuse | expand

Commit Message

SeongJae Park May 4, 2022, 8:07 p.m. UTC
Commit 9a44f3462edc ("mm/shmem: convert shmem_add_to_page_cache to take
a folio") on 'mm-unstable' replaces 'PageTransHuge()' with
'folio_test_large()' instead of 'folio_test_transhuge()'.  This results
in below build error when 'CONFIG_TRANSPARENT_HUGEPAGE' is unset.

      CC      mm/shmem.o
    In file included from <command-line>:
    In function ‘shmem_add_to_page_cache’,
        inlined from ‘shmem_getpage_gfp.isra.0’ at .../linux/mm/shmem.c:1912:10:
    .../linux/include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_244’ declared with attribute error: BUILD_BUG failed
      352 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
          |                                      ^
    .../linux/include/linux/compiler_types.h:333:4: note: in definition of macro ‘__compiletime_assert’
      333 |    prefix ## suffix();    \
          |    ^~~~~~
    .../linux/include/linux/compiler_types.h:352:2: note: in expansion of macro ‘_compiletime_assert’
      352 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
          |  ^~~~~~~~~~~~~~~~~~~
    .../linux/include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
          |                                     ^~~~~~~~~~~~~~~~~~
    .../linux/include/linux/build_bug.h:59:21: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
       59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
          |                     ^~~~~~~~~~~~~~~~
    .../linux/include/linux/vm_event_item.h:147:27: note: in expansion of macro ‘BUILD_BUG’
      147 | #define THP_FILE_ALLOC ({ BUILD_BUG(); 0; })
          |                           ^~~~~~~~~
    .../linux/mm/shmem.c:743:19: note: in expansion of macro ‘THP_FILE_ALLOC’
      743 |    count_vm_event(THP_FILE_ALLOC);
          |                   ^~~~~~~~~~~~~~

This commit fixes the issue by replacing the check to use
'folio_test_transhuge()'.

Fixes: 9a44f3462edc ("mm/shmem: convert shmem_add_to_page_cache to take a folio")
Signed-off-by: SeongJae Park <sj@kernel.org>
---
 mm/shmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mm/shmem.c b/mm/shmem.c
index 6a18641a90ff..3dc34a5a7923 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -739,7 +739,7 @@  static int shmem_add_to_page_cache(struct folio *folio,
 		xas_store(&xas, folio);
 		if (xas_error(&xas))
 			goto unlock;
-		if (folio_test_large(folio)) {
+		if (folio_test_transhuge(folio)) {
 			count_vm_event(THP_FILE_ALLOC);
 			__lruvec_stat_mod_folio(folio, NR_SHMEM_THPS, nr);
 		}