mm: introduce wrappers to access mm->nr_ptes
Let's add wrappers for ->nr_ptes with the same interface as for nr_pmd and nr_pud. The patch also makes nr_ptes accounting dependent onto CONFIG_MMU. Page table accounting doesn't make sense if you don't have page tables. It's preparation for consolidation of page-table counters in mm_struct. Link: http://lkml.kernel.org/r/20171006100651.44742-1-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Acked-by: Michal Hocko <mhocko@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
b4e98d9ac7
commit
c4812909f5
@@ -606,7 +606,7 @@ static int __do_huge_pmd_anonymous_page(struct vm_fault *vmf, struct page *page,
|
||||
pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, pgtable);
|
||||
set_pmd_at(vma->vm_mm, haddr, vmf->pmd, entry);
|
||||
add_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR);
|
||||
atomic_long_inc(&vma->vm_mm->nr_ptes);
|
||||
mm_inc_nr_ptes(vma->vm_mm);
|
||||
spin_unlock(vmf->ptl);
|
||||
count_vm_event(THP_FAULT_ALLOC);
|
||||
}
|
||||
@@ -662,7 +662,7 @@ static bool set_huge_zero_page(pgtable_t pgtable, struct mm_struct *mm,
|
||||
if (pgtable)
|
||||
pgtable_trans_huge_deposit(mm, pmd, pgtable);
|
||||
set_pmd_at(mm, haddr, pmd, entry);
|
||||
atomic_long_inc(&mm->nr_ptes);
|
||||
mm_inc_nr_ptes(mm);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -747,7 +747,7 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr,
|
||||
|
||||
if (pgtable) {
|
||||
pgtable_trans_huge_deposit(mm, pmd, pgtable);
|
||||
atomic_long_inc(&mm->nr_ptes);
|
||||
mm_inc_nr_ptes(mm);
|
||||
}
|
||||
|
||||
set_pmd_at(mm, addr, pmd, entry);
|
||||
@@ -978,7 +978,7 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
|
||||
get_page(src_page);
|
||||
page_dup_rmap(src_page, true);
|
||||
add_mm_counter(dst_mm, MM_ANONPAGES, HPAGE_PMD_NR);
|
||||
atomic_long_inc(&dst_mm->nr_ptes);
|
||||
mm_inc_nr_ptes(dst_mm);
|
||||
pgtable_trans_huge_deposit(dst_mm, dst_pmd, pgtable);
|
||||
|
||||
pmdp_set_wrprotect(src_mm, addr, src_pmd);
|
||||
@@ -1695,7 +1695,7 @@ static inline void zap_deposited_table(struct mm_struct *mm, pmd_t *pmd)
|
||||
|
||||
pgtable = pgtable_trans_huge_withdraw(mm, pmd);
|
||||
pte_free(mm, pgtable);
|
||||
atomic_long_dec(&mm->nr_ptes);
|
||||
mm_dec_nr_ptes(mm);
|
||||
}
|
||||
|
||||
int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
|
||||
|
Reference in New Issue
Block a user