Skip to contentSkip to conversation

powerpc: mm: use macro PGTABLE_EADDR_SIZE instead of digital

PATCH In review Liu Ping Fan 5 participants 6 messages Nov 21, 2013 – Apr 30, 2014 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 powerpc: mm: use macro PGTABLE_EADDR_SIZE instead of digital

In case of extending the eaddr in future, use this macro PGTABLE_EADDR_SIZE to ease the maintenance of the code.

---
 arch/powerpc/mm/slb_low.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/mm/slb_low.S +1 -1
index 17aa6df..e0b3cf4 100644
@@ -35,7 +35,7 @@ _GLOBAL(slb_allocate_realmode)
 	 * check for bad kernel/user address
 	 * (ea & ~REGION_MASK) >= PGTABLE_RANGE
 	 */
-	rldicr. r9,r3,4,(63 - 46 - 4)
+	rldicr. r9,r3,4,(63 - PGTABLE_EADDR_SIZE - 4)
 	bne-	8f
 
 	srdi	r9,r3,60		/* get region */
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 2/2 powerpc: mm: change pgtable index size for 64K page

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.

---
 arch/powerpc/include/asm/pgtable-ppc64-64k.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/pgtable-ppc64-64k.h +2 -2
index a56b82f..f6955ff 100644
@@ -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)
Signature · 1 line
1.8.1.4
#2 lore raw

Re: [PATCH 2/2] powerpc: mm: change pgtable index size for 64K page

Quoted 15 lines · Liu Ping Fan

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.

---
 arch/powerpc/include/asm/pgtable-ppc64-64k.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/pgtable-ppc64-64k.h +0 -0
index a56b82f..f6955ff 100644

arch/powerpc/include/asm/pgtable-ppc64-64k.h line 10

Quoted 9 lines
arch/powerpc/include/asm/pgtable-ppc64-64k.h +2 -2
@@ -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.

#3 lore raw

Re: [PATCH 2/2] powerpc: mm: change pgtable index size for 64K page

Quoted 5 lines · Paul Mackerras
Quoted 4 lines · Liu Ping Fan

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.

Quoted 25 lines
Quoted 10 lines
---
 arch/powerpc/include/asm/pgtable-ppc64-64k.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/pgtable-ppc64-64k.h +0 -0
index a56b82f..f6955ff 100644

arch/powerpc/include/asm/pgtable-ppc64-64k.h line 10

Quoted 9 lines
arch/powerpc/include/asm/pgtable-ppc64-64k.h +2 -2
@@ -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.

#4 lore raw

Re: [PATCH 2/2] powerpc: mm: change pgtable index size for 64K page

Quoted 9 lines · Benjamin Herrenschmidt
Quoted 5 lines · Paul Mackerras
Quoted 4 lines · Liu Ping Fan

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

Reviewed-by on v1 1/2
#5 lore raw
In reply to Liu Ping Fan
Quoted 4 lines · Liu Ping Fan

In case of extending the eaddr in future, use this macro PGTABLE_EADDR_SIZE to ease the maintenance of the code.

Quoted 24 lines
---
 arch/powerpc/mm/slb_low.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/mm/slb_low.S +1 -1
index 17aa6df..e0b3cf4 100644
@@ -35,7 +35,7 @@ _GLOBAL(slb_allocate_realmode)
 	 * check for bad kernel/user address
 	 * (ea & ~REGION_MASK) >= PGTABLE_RANGE
 	 */
-	rldicr. r9,r3,4,(63 - 46 - 4)
+	rldicr. r9,r3,4,(63 - PGTABLE_EADDR_SIZE - 4)
 	bne-	8f
 
 	srdi	r9,r3,60		/* get region */
Signature · 6 lines
1.8.1.4

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev