OSDN Git Service

x86/mm: Fold p4d page table layer at runtime
[uclinux-h8/linux.git] / arch / x86 / include / asm / pgalloc.h
index aff42e1..263c142 100644 (file)
@@ -167,6 +167,8 @@ static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
 #if CONFIG_PGTABLE_LEVELS > 4
 static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, p4d_t *p4d)
 {
+       if (!pgtable_l5_enabled)
+               return;
        paravirt_alloc_p4d(mm, __pa(p4d) >> PAGE_SHIFT);
        set_pgd(pgd, __pgd(_PAGE_TABLE | __pa(p4d)));
 }
@@ -191,7 +193,8 @@ extern void ___p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d);
 static inline void __p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d,
                                  unsigned long address)
 {
-       ___p4d_free_tlb(tlb, p4d);
+       if (pgtable_l5_enabled)
+               ___p4d_free_tlb(tlb, p4d);
 }
 
 #endif /* CONFIG_PGTABLE_LEVELS > 4 */