aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/mm/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/mm/init.c')
-rw-r--r--arch/i386/mm/init.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index e8545dcf06c5..dbe16f63a566 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -745,6 +745,8 @@ struct kmem_cache *pmd_cache;
745 745
746void __init pgtable_cache_init(void) 746void __init pgtable_cache_init(void)
747{ 747{
748 size_t pgd_size = PTRS_PER_PGD*sizeof(pgd_t);
749
748 if (PTRS_PER_PMD > 1) { 750 if (PTRS_PER_PMD > 1) {
749 pmd_cache = kmem_cache_create("pmd", 751 pmd_cache = kmem_cache_create("pmd",
750 PTRS_PER_PMD*sizeof(pmd_t), 752 PTRS_PER_PMD*sizeof(pmd_t),
@@ -754,13 +756,23 @@ void __init pgtable_cache_init(void)
754 NULL); 756 NULL);
755 if (!pmd_cache) 757 if (!pmd_cache)
756 panic("pgtable_cache_init(): cannot create pmd cache"); 758 panic("pgtable_cache_init(): cannot create pmd cache");
759
760 if (!SHARED_KERNEL_PMD) {
761 /* If we're in PAE mode and have a non-shared
762 kernel pmd, then the pgd size must be a
763 page size. This is because the pgd_list
764 links through the page structure, so there
765 can only be one pgd per page for this to
766 work. */
767 pgd_size = PAGE_SIZE;
768 }
757 } 769 }
758 pgd_cache = kmem_cache_create("pgd", 770 pgd_cache = kmem_cache_create("pgd",
759 PTRS_PER_PGD*sizeof(pgd_t), 771 pgd_size,
760 PTRS_PER_PGD*sizeof(pgd_t), 772 pgd_size,
761 0, 773 0,
762 pgd_ctor, 774 pgd_ctor,
763 PTRS_PER_PMD == 1 ? pgd_dtor : NULL); 775 (!SHARED_KERNEL_PMD) ? pgd_dtor : NULL);
764 if (!pgd_cache) 776 if (!pgd_cache)
765 panic("pgtable_cache_init(): Cannot create pgd cache"); 777 panic("pgtable_cache_init(): Cannot create pgd cache");
766} 778}