Re: [PATCH] mm/shmem: fix build failure when CONFIG_TRANSPARENT_HUGEPAGE is not set

From: Andrew Morton
Date: Sat May 07 2022 - 14:55:21 EST


On Thu, 5 May 2022 11:33:55 +0000 cgel.zte@xxxxxxxxx wrote:

> From: Yang Yang <yang.yang29@xxxxxxxxxx>
>
> 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.