Re: [PATCH V2] mm: Introduce GFP_PGTABLE

From: Matthew Wilcox
Date: Wed Jan 16 2019 - 09:20:23 EST


On Wed, Jan 16, 2019 at 02:47:16PM +0100, Christophe Leroy wrote:
> Le 16/01/2019 à 14:18, Matthew Wilcox a écrit :
> > I disagree with your objective. Making more code common is a great idea,
> > but this patch is too unambitious. We should be heading towards one or
> > two page table allocation functions instead of having every architecture do
> > its own thing.
> >
> > So start there. Move the x86 function into common code and convert one
> > other architecture to use it too.
>
> Are we talking about pte_alloc_one_kernel() and pte_alloc_one() ?
>
> I'm not sure x86 function is the best common one, as it seems to allocate a
> multiple of PAGE_SIZE only.

And that's the common case. Most architectures use a single page for at
least one level of the pte/pmd/pud/p4d/pgd hierarchy. Some use multiple
pages and some use a fraction of a page.

> Some arches like powerpc use pagetables which are smaller than a page, for
> instance powerpc 8xx uses 4k pagetables even with 16k pages, which means a
> single page can be used by 4 pagetables.

Those can be added later. Note I said "one or two", and that's what I
had in mind; I think we want one function that allocates just a page
and another that allocates a page fragment. Then we can have a good
discussion about what method we use; s390 and ppc use different techniques
today and there's really no good reason for that.