mbox series

[V2,0/6] arm64/mm: Enable accounting for page table pages

Message ID 1551071039-20192-1-git-send-email-anshuman.khandual@arm.com (mailing list archive)
Headers show
Series arm64/mm: Enable accounting for page table pages | expand

Message

Anshuman Khandual Feb. 25, 2019, 5:03 a.m. UTC
Currently page table page allocation and release has multiple combinations
for user space and kernel mapping page tables. Not only this is vulnerable
for bad page state errors it also prevents accurate accounting for those
pages through NR_PAGETABLE. This patch series attempts to standardize all
(except PGD slab cache 'pdg_cache') page table page allocation and release
through pte_alloc_one()/pte_free() which in turn guarantees that all these
pages will go trough pgtable_page_[ctor|dtor] constructs. It also takes
care of some of the pages who might have been allocated early via memblock.

This enables memcg based accounting for user process page table pages via
__GFP_ACCOUNT. For now this also removes standard ptable page allocators
usage from KVM stage-2 as some of them use multi order allocation which is
not supported in a generic way.

While here, enable ARCH_ENABLE_SPLIT_PMD_PTLOCK which can improve memory
scalability on larger systems. This enablement was first proposed [1] by
Yu Zhao using generic pgtable_pmd_page_ctor() which does not take zone stat
and page state into account. Hence the current proposal tries to merge both
through an arm64 specific helper pgtable_pmd_page_ctor_workaround() which
should eventually be dropped once we fix generic functions.

[1] https://patchwork.kernel.org/patch/10813793/

Changes in V2:

- Created temporary page structures in __[pmd|pud]_free_tlb per Will
- Incorporated efi_mm while determining pgtable allocation flag per Will
- Dropped parts of commit message from patch 'arm64/mm: Make all page table pages'
- Dropped patch 'arm64/mm: Ensure PGD kmem cache object is actually allocated'
- Added new patch 'arm64/mm: Enable ARCH_ENABLE_SPLIT_PMD_PTLOCK'

V1: https://www.spinics.net/lists/arm-kernel/msg701954.html

Anshuman Khandual (6):
  KVM: ARM: Remove pgtable standard functions from stage-2 page tables
  arm64/mm: Make pgd_pgtable_alloc() call pte_alloc_one() always
  arm64/mm: Make all page table pages cycles through standard constructs
  arm64/mm: Call pgtable_page_dtor() for both PMD and PUD page table pages
  arm64/mm: Enable page table page accounting for user space
  arm64/mm: Enable ARCH_ENABLE_SPLIT_PMD_PTLOCK

 arch/arm/include/asm/stage2_pgtable.h   |  4 +-
 arch/arm64/Kconfig                      |  4 ++
 arch/arm64/include/asm/pgalloc.h        | 95 ++++++++++++++++++++++---
 arch/arm64/include/asm/stage2_pgtable.h |  4 +-
 arch/arm64/include/asm/tlb.h            |  6 ++
 arch/arm64/mm/mmu.c                     | 17 +++--
 arch/arm64/mm/pgd.c                     |  4 +-
 7 files changed, 115 insertions(+), 19 deletions(-)