Re: [PATCH V8] mm/debug: Add tests validating architecture page table helpers

Vineet Gupta
2019-11-06T18:08:30Z

On 11/5/19 7:03 PM, Anshuman Khandual wrote:
> But should not pfn_pmd() be encapsulated inside HAVE_ARCH_TRANSPARENT_HUGEPAGE
> at the minimum (but I would say it should be available always, nonetheless) when
> the platform subscribes to THP irrespective of whether THP is enabled or not.

For ARC it was only introduced/needed when I added THP support so it is dependent
in some way.

> I could see in the file (arch/arc/include/asm/pgtable.h) that fetching pfn_pmd()
> and all other basic PMD definitions is conditional on CONFIG_TRANSPARENT_HUGEPAGE.
>
> #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> #include <asm/hugepage.h>
> #endif
>
> IIUC, CONFIG_TRANSPARENT_HUGEPAGE should only encapsulate PMD page table helpers
> which are expected from generic THP code (pmd_trans_huge, pmdp_set_access_flags
> etc) but not the basic PMD helpers like pmd_pfn, pmd_mkyoung, pmd_mkdirty,
> pmd_mkclean etc.

ARC only has 2 levels of paging, so these don't make any sense in general and
needed only for THP case.
I case of arch/arm you see it is only defined in pgtable-3level.h

> Hence wondering will it be possible to accommodate following
> code change on arc platform (not even compiled) in order to fix the problem ?

I'm open to making changes in ARC code but lets do the right thing.

> */
> -#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> +#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE
> #include <asm/hugepage.h>
> #endif

This in wrong.  CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE is a just a glue toggle,
used only in Kconfig files (and not in any "C" code).  It enables generic Kconfig
code to allow visibility of CONFIG_TRANSPARENT_HUGEPAGE w/o every arch needing to
do a me too.

I think you need to use CONFIG_TRANSPARENT_HUGEPAGE to guard appropriate tests. I
understand that it only

-Vineet