aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/huge_memory.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 04eb489a6805..1ee34ddb46ad 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1085,15 +1085,20 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
1085 pmd_t orig_pmd; 1085 pmd_t orig_pmd;
1086 pgtable = pgtable_trans_huge_withdraw(tlb->mm); 1086 pgtable = pgtable_trans_huge_withdraw(tlb->mm);
1087 orig_pmd = pmdp_get_and_clear(tlb->mm, addr, pmd); 1087 orig_pmd = pmdp_get_and_clear(tlb->mm, addr, pmd);
1088 page = pmd_page(orig_pmd);
1089 tlb_remove_pmd_tlb_entry(tlb, pmd, addr); 1088 tlb_remove_pmd_tlb_entry(tlb, pmd, addr);
1090 page_remove_rmap(page); 1089 if (is_huge_zero_pmd(orig_pmd)) {
1091 VM_BUG_ON(page_mapcount(page) < 0); 1090 tlb->mm->nr_ptes--;
1092 add_mm_counter(tlb->mm, MM_ANONPAGES, -HPAGE_PMD_NR); 1091 spin_unlock(&tlb->mm->page_table_lock);
1093 VM_BUG_ON(!PageHead(page)); 1092 } else {
1094 tlb->mm->nr_ptes--; 1093 page = pmd_page(orig_pmd);
1095 spin_unlock(&tlb->mm->page_table_lock); 1094 page_remove_rmap(page);
1096 tlb_remove_page(tlb, page); 1095 VM_BUG_ON(page_mapcount(page) < 0);
1096 add_mm_counter(tlb->mm, MM_ANONPAGES, -HPAGE_PMD_NR);
1097 VM_BUG_ON(!PageHead(page));
1098 tlb->mm->nr_ptes--;
1099 spin_unlock(&tlb->mm->page_table_lock);
1100 tlb_remove_page(tlb, page);
1101 }
1097 pte_free(tlb->mm, pgtable); 1102 pte_free(tlb->mm, pgtable);
1098 ret = 1; 1103 ret = 1;
1099 } 1104 }