Re: [PATCH v2 07/13] powerpc: add support for folded p4d page tables

From: Christophe Leroy
Date: Wed Feb 26 2020 - 06:21:08 EST




Le 26/02/2020 Ã 11:56, Mike Rapoport a ÃcritÂ:
On Wed, Feb 26, 2020 at 10:46:13AM +0100, Christophe Leroy wrote:


Le 26/02/2020 Ã 10:13, Mike Rapoport a ÃcritÂ:
On Tue, Feb 18, 2020 at 12:54:40PM +0200, Mike Rapoport wrote:
On Sun, Feb 16, 2020 at 11:41:07AM +0100, Christophe Leroy wrote:


Le 16/02/2020 Ã 09:18, Mike Rapoport a ÃcritÂ:
From: Mike Rapoport <rppt@xxxxxxxxxxxxx>

Implement primitives necessary for the 4th level folding, add walks of p4d
level where appropriate and replace 5level-fixup.h with pgtable-nop4d.h.

I don't think it is worth adding all this additionnals walks of p4d, this
patch could be limited to changes like:

- pud = pud_offset(pgd, gpa);
+ pud = pud_offset(p4d_offset(pgd, gpa), gpa);

The additionnal walks should be added through another patch the day powerpc
need them.

Ok, I'll update the patch to reduce walking the p4d.

Here's what I have with more direct acceses from pgd to pud.

I went quickly through. This looks promising.

Do we need the walk_p4d() in arch/powerpc/mm/ptdump/hashpagetable.c ?
Can't we just do

@@ -445,7 +459,7 @@ static void walk_pagetables(struct pg_state *st)
addr = KERN_VIRT_START + i * PGDIR_SIZE;
if (!pgd_none(*pgd))
/* pgd exists */
- walk_pud(st, pgd, addr);
+ walk_pud(st, p4d_offset(pgd, addr), addr);

We can do

addr = KERN_VIRT_START + i * PGDIR_SIZE;
p4d = p4d_offset(pgd, addr);
if (!p4d_none(*pgd))
walk_pud()

But I don't think this is really essential. Again, we are trading off code
consistency vs line count. I don't think line count is that important.

Ok.

Christophe