Re: [PATCH 08/16] sparc64: add the missing pgd_page definition

From: Christoph Hellwig
Date: Mon Jun 03 2019 - 03:48:33 EST


On Sat, Jun 01, 2019 at 09:28:54AM -0700, Linus Torvalds wrote:
> Both sparc64 and sh had this pattern, but now that I look at it more
> closely, I think your version is wrong, or at least nonoptimal.

I bet it is. Then again these symbols are just required for the code
to compile, as neither sparc64 nor sh actually use the particular
variant of huge pages we need it for. Then again even actually dead
code should better be not too buggy if it isn't just a stub.

> So I thgink this would be better done with
>
> #define pgd_page(pgd) pfn_to_page(pgd_pfn(pgd))
>
> where that "pgd_pfn()" would need to be a new (but likely very
> trivial) function. That's what we do for pte_pfn().
>
> IOW, it would likely end up something like
>
> #define pgd_to_pfn(pgd) (pgd_val(x) >> PFN_PGD_SHIFT)

True. I guess it would be best if we could get most if not all
architectures to use common versions of these macros so that we have
the issue settled once.