Re: [PATCH v2 03/13] mm: Add generic p?d_large() macros

From: Kirill A. Shutemov
Date: Fri Mar 01 2019 - 07:28:51 EST


On Fri, Mar 01, 2019 at 01:49:53PM +0200, Mike Rapoport wrote:
> Hi Kirill,
>
> On Thu, Feb 21, 2019 at 05:57:06PM +0300, Kirill A. Shutemov wrote:
> > On Thu, Feb 21, 2019 at 02:46:18PM +0000, Steven Price wrote:
> > > On 21/02/2019 14:28, Kirill A. Shutemov wrote:
> > > > On Thu, Feb 21, 2019 at 11:34:52AM +0000, Steven Price wrote:
> > > >> From: James Morse <james.morse@xxxxxxx>
> > > >>
> > > >> Exposing the pud/pgd levels of the page tables to walk_page_range() means
> > > >> we may come across the exotic large mappings that come with large areas
> > > >> of contiguous memory (such as the kernel's linear map).
> > > >>
> > > >> For architectures that don't provide p?d_large() macros, provided a
> > > >> does nothing default.
> > > >
> > > > Nak, sorry.
> > > >
> > > > Power will get broken by the patch. It has pmd_large() inline function,
> > > > that will be overwritten by the define from this patch.
> > > >
> > > > I believe it requires more ground work on arch side in general.
> > > > All architectures that has huge page support has to provide these helpers
> > > > (and matching defines) before you can use it in a generic code.
> > >
> > > Sorry about that, I had compile tested on power, but obviously not the
> > > right config to actually see the breakage.
> >
> > I don't think you'll catch it at compile-time. It would silently override
> > the helper with always-false.
>
> Can you explain why the compiler would override the helper define in, e.g.
> arch/powerpc/include/asm/pgtable.h with the generic (0)?

This one will not be overrided, but the other one will. See

arch/powerpc/include/asm/book3s/64/pgtable.h

--
Kirill A. Shutemov