diff options
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/mm/memory.c b/mm/memory.c index d63849b5188f..bbe6a73a899d 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -428,6 +428,7 @@ static inline void free_pmd_range(struct mmu_gather *tlb, pud_t *pud, | |||
428 | pmd = pmd_offset(pud, start); | 428 | pmd = pmd_offset(pud, start); |
429 | pud_clear(pud); | 429 | pud_clear(pud); |
430 | pmd_free_tlb(tlb, pmd, start); | 430 | pmd_free_tlb(tlb, pmd, start); |
431 | mm_dec_nr_pmds(tlb->mm); | ||
431 | } | 432 | } |
432 | 433 | ||
433 | static inline void free_pud_range(struct mmu_gather *tlb, pgd_t *pgd, | 434 | static inline void free_pud_range(struct mmu_gather *tlb, pgd_t *pgd, |
@@ -3322,15 +3323,17 @@ int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address) | |||
3322 | 3323 | ||
3323 | spin_lock(&mm->page_table_lock); | 3324 | spin_lock(&mm->page_table_lock); |
3324 | #ifndef __ARCH_HAS_4LEVEL_HACK | 3325 | #ifndef __ARCH_HAS_4LEVEL_HACK |
3325 | if (pud_present(*pud)) /* Another has populated it */ | 3326 | if (!pud_present(*pud)) { |
3326 | pmd_free(mm, new); | 3327 | mm_inc_nr_pmds(mm); |
3327 | else | ||
3328 | pud_populate(mm, pud, new); | 3328 | pud_populate(mm, pud, new); |
3329 | #else | 3329 | } else /* Another has populated it */ |
3330 | if (pgd_present(*pud)) /* Another has populated it */ | ||
3331 | pmd_free(mm, new); | 3330 | pmd_free(mm, new); |
3332 | else | 3331 | #else |
3332 | if (!pgd_present(*pud)) { | ||
3333 | mm_inc_nr_pmds(mm); | ||
3333 | pgd_populate(mm, pud, new); | 3334 | pgd_populate(mm, pud, new); |
3335 | } else /* Another has populated it */ | ||
3336 | pmd_free(mm, new); | ||
3334 | #endif /* __ARCH_HAS_4LEVEL_HACK */ | 3337 | #endif /* __ARCH_HAS_4LEVEL_HACK */ |
3335 | spin_unlock(&mm->page_table_lock); | 3338 | spin_unlock(&mm->page_table_lock); |
3336 | return 0; | 3339 | return 0; |