[2/2] powerpc: mm: change pgtable index size for 64K page
diff mbox

Message ID 1385000275-5988-2-git-send-email-pingfank@linux.vnet.ibm.com
State Rejected
Headers show

Commit Message

Pingfan Liu Nov. 21, 2013, 2:17 a.m. UTC
For 64K page, we waste half of the pte_t page. With this patch, after
changing PGD_INDEX_SIZE from 12 to 11, PTE_INDEX_SIZE from 8 to 9,
we can improve the usage of pte_t page and shrink the continuous phys
size for pgd_t.

Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/pgtable-ppc64-64k.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Paul Mackerras Nov. 21, 2013, 10:11 p.m. UTC | #1
On Thu, Nov 21, 2013 at 10:17:55AM +0800, Liu Ping Fan wrote:
> For 64K page, we waste half of the pte_t page. With this patch, after
> changing PGD_INDEX_SIZE from 12 to 11, PTE_INDEX_SIZE from 8 to 9,
> we can improve the usage of pte_t page and shrink the continuous phys
> size for pgd_t.
> 
> Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
> ---
>  arch/powerpc/include/asm/pgtable-ppc64-64k.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/pgtable-ppc64-64k.h b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
> index a56b82f..f6955ff 100644
> --- a/arch/powerpc/include/asm/pgtable-ppc64-64k.h
> +++ b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
> @@ -4,10 +4,10 @@
>  #include <asm-generic/pgtable-nopud.h>
>  
>  
> -#define PTE_INDEX_SIZE  8
> +#define PTE_INDEX_SIZE  9
>  #define PMD_INDEX_SIZE  10
>  #define PUD_INDEX_SIZE	0
> -#define PGD_INDEX_SIZE  12
> +#define PGD_INDEX_SIZE  11

Nack.  Those definitions are the way they are in order to have the PMD
map 16MB, which is our large page size, so that transparent huge pages
work.

Paul.
Benjamin Herrenschmidt Nov. 21, 2013, 11:46 p.m. UTC | #2
On Fri, 2013-11-22 at 09:11 +1100, Paul Mackerras wrote:
> On Thu, Nov 21, 2013 at 10:17:55AM +0800, Liu Ping Fan wrote:
> > For 64K page, we waste half of the pte_t page. With this patch, after
> > changing PGD_INDEX_SIZE from 12 to 11, PTE_INDEX_SIZE from 8 to 9,
> > we can improve the usage of pte_t page and shrink the continuous phys
> > size for pgd_t.

Also you did you miss that we use the second half to store the
per-subpage hash info when using 64k on top of HW 4k ?

Cheers,
Ben.

> > Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
> > ---
> >  arch/powerpc/include/asm/pgtable-ppc64-64k.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/powerpc/include/asm/pgtable-ppc64-64k.h b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
> > index a56b82f..f6955ff 100644
> > --- a/arch/powerpc/include/asm/pgtable-ppc64-64k.h
> > +++ b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
> > @@ -4,10 +4,10 @@
> >  #include <asm-generic/pgtable-nopud.h>
> >  
> >  
> > -#define PTE_INDEX_SIZE  8
> > +#define PTE_INDEX_SIZE  9
> >  #define PMD_INDEX_SIZE  10
> >  #define PUD_INDEX_SIZE	0
> > -#define PGD_INDEX_SIZE  12
> > +#define PGD_INDEX_SIZE  11
> 
> Nack.  Those definitions are the way they are in order to have the PMD
> map 16MB, which is our large page size, so that transparent huge pages
> work.
> 
> Paul.
Michael Ellerman Nov. 22, 2013, 2:06 a.m. UTC | #3
On Fri, 2013-11-22 at 10:46 +1100, Benjamin Herrenschmidt wrote:
> On Fri, 2013-11-22 at 09:11 +1100, Paul Mackerras wrote:
> > On Thu, Nov 21, 2013 at 10:17:55AM +0800, Liu Ping Fan wrote:
> > > For 64K page, we waste half of the pte_t page. With this patch, after
> > > changing PGD_INDEX_SIZE from 12 to 11, PTE_INDEX_SIZE from 8 to 9,
> > > we can improve the usage of pte_t page and shrink the continuous phys
> > > size for pgd_t.
> 
> Also you did you miss that we use the second half to store the
> per-subpage hash info when using 64k on top of HW 4k ?

Given the subtleties perhaps a nice big block comment is in order ? :)

cheers

Patch
diff mbox

diff --git a/arch/powerpc/include/asm/pgtable-ppc64-64k.h b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
index a56b82f..f6955ff 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64-64k.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
@@ -4,10 +4,10 @@ 
 #include <asm-generic/pgtable-nopud.h>
 
 
-#define PTE_INDEX_SIZE  8
+#define PTE_INDEX_SIZE  9
 #define PMD_INDEX_SIZE  10
 #define PUD_INDEX_SIZE	0
-#define PGD_INDEX_SIZE  12
+#define PGD_INDEX_SIZE  11
 
 #ifndef __ASSEMBLY__
 #define PTE_TABLE_SIZE	(sizeof(real_pte_t) << PTE_INDEX_SIZE)