* [PATCH] mm/shmem: fix build failure when CONFIG_TRANSPARENT_HUGEPAGE is not set
@ 2022-05-05 11:33 cgel.zte
2022-05-07 18:55 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-05-05 11:33 UTC (permalink / raw)
To: hughd, akpm; +Cc: linux-mm, linux-kernel, Yang Yang, Zeal Robot
From: Yang Yang <yang.yang29@zte.com.cn>
shmem_add_to_page_cache() use THP_FILE_FALLBACK even if
CONFIG_TRANSPARENT_HUGEPAGE is not set and triggers this
compile error.
Add ifdef CONFIG_TRANSPARENT_HUGEPAGE in shmem_add_to_page_cache().
In file included from <command-line>:
mm/shmem.c: In function ‘shmem_add_to_page_cache’:
././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_327’ declared with attribute error: BUILD_BUG failed
352 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^
././include/linux/compiler_types.h:333:4: note: in definition of macro ‘__compiletime_assert’
333 | prefix ## suffix(); \
| ^~~~~~
././include/linux/compiler_types.h:352:2: note: in expansion of macro ‘_compiletime_assert’
352 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
./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)
| ^~~~~~~~~~~~~~~~~~
./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")
| ^~~~~~~~~~~~~~~~
./include/linux/vm_event_item.h:148:30: note: in expansion of macro ‘BUILD_BUG’
148 | #define THP_FILE_FALLBACK ({ BUILD_BUG(); 0; })
| ^~~~~~~~~
mm/shmem.c:721:20: note: in expansion of macro ‘THP_FILE_FALLBACK’
721 | count_vm_event(THP_FILE_FALLBACK);
| ^~~~~~~~~~~~~~~~~
CC arch/x86/events/intel/p4.o
make[1]: *** [scripts/Makefile.build:288: mm/shmem.o] Error 1
make: *** [Makefile:1997: mm] Error 2
make: *** Waiting for unfinished jobs....
Signed-off-by: Yang Yang <yang.yang29@zte.com.cn>
Reported-by: Zeal Robot <zealci@zte.com.cn>
---
mm/shmem.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/shmem.c b/mm/shmem.c
index 107f1e4dd0aa..f01ceedf88c0 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -717,10 +717,12 @@ static int shmem_add_to_page_cache(struct folio *folio,
if (!folio_test_swapcache(folio)) {
error = mem_cgroup_charge(folio, charge_mm, gfp);
if (error) {
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
if (folio_test_large(folio)) {
count_vm_event(THP_FILE_FALLBACK);
count_vm_event(THP_FILE_FALLBACK_CHARGE);
}
+#endif
goto error;
}
}
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/shmem: fix build failure when CONFIG_TRANSPARENT_HUGEPAGE is not set
2022-05-05 11:33 [PATCH] mm/shmem: fix build failure when CONFIG_TRANSPARENT_HUGEPAGE is not set cgel.zte
@ 2022-05-07 18:55 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2022-05-07 18:55 UTC (permalink / raw)
To: cgel.zte
Cc: hughd, linux-mm, linux-kernel, Yang Yang, Zeal Robot, Matthew Wilcox
On Thu, 5 May 2022 11:33:55 +0000 cgel.zte@gmail.com wrote:
> From: Yang Yang <yang.yang29@zte.com.cn>
>
> shmem_add_to_page_cache() use THP_FILE_FALLBACK even if
> CONFIG_TRANSPARENT_HUGEPAGE is not set and triggers this
> compile error.
>
> Add ifdef CONFIG_TRANSPARENT_HUGEPAGE in shmem_add_to_page_cache().
Thanks.
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -717,10 +717,12 @@ static int shmem_add_to_page_cache(struct folio *folio,
> if (!folio_test_swapcache(folio)) {
> error = mem_cgroup_charge(folio, charge_mm, gfp);
> if (error) {
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> if (folio_test_large(folio)) {
> count_vm_event(THP_FILE_FALLBACK);
> count_vm_event(THP_FILE_FALLBACK_CHARGE);
> }
> +#endif
> goto error;
> }
> }
I believe Matthew address this in version 2 of "Folio patches for
5.19".
I'm aiming to get that (and much more!) pushed out or Monday's linux-next.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-07 18:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05 11:33 [PATCH] mm/shmem: fix build failure when CONFIG_TRANSPARENT_HUGEPAGE is not set cgel.zte
2022-05-07 18:55 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox