Skip to contentSkip to conversation

sparc64: Use kernel page tables for vmemmap.

PATCH New David Miller 1 participant 1 message Oct 4, 2014 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 5/9 sparc64: Use kernel page tables for vmemmap.

For sparse memory configurations, the vmemmap array behaves terribly and it takes up an inordinate amount of space in the BSS section of the kernel image unconditionally.

Just build huge PMDs and look them up just like we do for TLB misses in the vmalloc area.

Kernel BSS shrinks by about 2MB.

---
 arch/sparc/kernel/ktlb.S |  9 ++----
 arch/sparc/mm/init_64.c  | 72 +++++++++++++++++++++++-------------------------
 arch/sparc/mm/init_64.h  | 11 --------
 3 files changed, 36 insertions(+), 56 deletions(-)
arch/sparc/kernel/ktlb.S +2 -7
index 94a1e66..2627a7f 100644
@@ -186,13 +186,8 @@ kvmap_dtlb_load:
 
 #ifdef CONFIG_SPARSEMEM_VMEMMAP
 kvmap_vmemmap:
-	sub		%g4, %g5, %g5
-	srlx		%g5, ILOG2_4MB, %g5
-	sethi		%hi(vmemmap_table), %g1
-	sllx		%g5, 3, %g5
-	or		%g1, %lo(vmemmap_table), %g1
-	ba,pt		%xcc, kvmap_dtlb_load
-	 ldx		[%g1 + %g5], %g5
+	KERN_PGTABLE_WALK(%g4, %g5, %g2, kvmap_dtlb_longpath)
+	ba,a,pt		%xcc, kvmap_dtlb_load
 #endif
 
 kvmap_dtlb_nonlinear:
arch/sparc/mm/init_64.c +34 -37

98 lines not on this page · raw message

arch/sparc/mm/init_64.h +0 -11
index 29ff73f..a4c0960 100644
@@ -31,15 +31,4 @@ extern unsigned long kern_locked_tte_data;
 
 void prom_world(int enter);
 
-#ifdef CONFIG_SPARSEMEM_VMEMMAP
-#define VMEMMAP_CHUNK_SHIFT	22
-#define VMEMMAP_CHUNK		(1UL << VMEMMAP_CHUNK_SHIFT)
-#define VMEMMAP_CHUNK_MASK	~(VMEMMAP_CHUNK - 1UL)
-#define VMEMMAP_ALIGN(x)	(((x)+VMEMMAP_CHUNK-1UL)&VMEMMAP_CHUNK_MASK)
-
-#define VMEMMAP_SIZE	((((1UL << MAX_PHYSADDR_BITS) >> PAGE_SHIFT) * \
-			  sizeof(struct page)) >> VMEMMAP_CHUNK_SHIFT)
-extern unsigned long vmemmap_table[VMEMMAP_SIZE];
-#endif
-
 #endif /* _SPARC64_MM_INIT_H */
Signature · 1 line
1.8.1.2