Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[POWERPC] Size swapper_pg_dir correctly

David Gibson pointed out that swapper_pg_dir actually need to be
PGD_TABLE_SIZE bytes long not PAGE_SIZE. This actually saves 64k in
the bss for a kernel ppc64_defconfig built with CONFIG_PPC_64K_PAGES.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by

Stephen Rothwell and committed by
Paul Mackerras
ee7a76da 19a8d97d

+9 -1
+4
arch/powerpc/kernel/asm-offsets.c
··· 320 320 DEFINE(VMALLOC_START_ESID, GET_ESID(VMALLOC_START)); 321 321 DEFINE(VMALLOC_START_VSID, KERNEL_VSID(VMALLOC_START)); 322 322 #endif 323 + 324 + #ifdef CONFIG_PPC64 325 + DEFINE(PGD_TABLE_SIZE, PGD_TABLE_SIZE); 326 + #endif 323 327 return 0; 324 328 }
+1 -1
arch/powerpc/kernel/head_64.S
··· 1539 1539 1540 1540 .globl swapper_pg_dir 1541 1541 swapper_pg_dir: 1542 - .space PAGE_SIZE 1542 + .space PGD_TABLE_SIZE
+2
include/asm-powerpc/pgtable-4k.h
··· 10 10 #define PUD_INDEX_SIZE 7 11 11 #define PGD_INDEX_SIZE 9 12 12 13 + #ifndef __ASSEMBLY__ 13 14 #define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_INDEX_SIZE) 14 15 #define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE) 15 16 #define PUD_TABLE_SIZE (sizeof(pud_t) << PUD_INDEX_SIZE) 16 17 #define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE) 18 + #endif /* __ASSEMBLY__ */ 17 19 18 20 #define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) 19 21 #define PTRS_PER_PMD (1 << PMD_INDEX_SIZE)
+2
include/asm-powerpc/pgtable-64k.h
··· 9 9 #define PUD_INDEX_SIZE 0 10 10 #define PGD_INDEX_SIZE 4 11 11 12 + #ifndef __ASSEMBLY__ 12 13 #define PTE_TABLE_SIZE (sizeof(real_pte_t) << PTE_INDEX_SIZE) 13 14 #define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE) 14 15 #define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE) 16 + #endif /* __ASSEMBLY__ */ 15 17 16 18 #define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) 17 19 #define PTRS_PER_PMD (1 << PMD_INDEX_SIZE)