linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/6] KVM: mm: count KVM page table pages in memory stats
@ 2022-04-26  5:38 Yosry Ahmed
  2022-04-26  5:38 ` [PATCH v3 1/6] mm: add NR_SECONDARY_PAGETABLE stat Yosry Ahmed
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Yosry Ahmed @ 2022-04-26  5:38 UTC (permalink / raw)
  To: Sean Christopherson, Huacai Chen, Aleksandar Markovic, Anup Patel,
	Atish Patra, Paolo Bonzini, Vitaly Kuznetsov, Wanpeng Li,
	Jim Mattson, Joerg Roedel, Andrew Morton, Johannes Weiner,
	Michal Hocko, Roman Gushchin, Shakeel Butt, James Morse,
	Catalin Marinas, Shameer Kolothum, Marc Zyngier, Alexandru Elisei,
	Suzuki K Poulose
  Cc: linux-mips, kvm, kvm-riscv, linux-kernel, linux-fsdevel, linux-mm,
	cgroups, linux-arm-kernel, kvmarm, Yosry Ahmed

We keep track of several kernel memory stats (total kernel memory, page
tables, stack, vmalloc, etc) on multiple levels (global, per-node,
per-memcg, etc). These stats give insights to users to how much memory
is used by the kernel and for what purposes.

Currently, memory used by kvm for its page tables is not accounted in
any of those kernel memory stats. This patch series accounts the memory
pages used by KVM for page tables in those stats in a new
NR_SECONDARY_PAGETABLE stat.

The riscv and mips patches are not tested due to lack of
resources. Feel free to test or drop them.

Changes in V3:
- Added NR_SECONDARY_PAGETABLE instead of piggybacking on NR_PAGETABLE
  stats.

Changes in V2:
- Added accounting stats for other archs than x86.
- Changed locations in the code where x86 KVM page table stats were
  accounted based on suggestions from Sean Christopherson.


Yosry Ahmed (6):
  mm: add NR_SECONDARY_PAGETABLE stat
  KVM: mmu: add a helper to account page table pages used by KVM.
  KVM: x86/mmu: count KVM page table pages in pagetable stats
  KVM: arm64/mmu: count KVM page table pages in pagetable stats
  KVM: riscv/mmu: count KVM page table pages in pagetable stats
  KVM: mips/mmu: count KVM page table pages in pagetable stats

 arch/arm64/kernel/image-vars.h |  3 ++
 arch/arm64/kvm/hyp/pgtable.c   | 50 +++++++++++++++++++++-------------
 arch/mips/kvm/mips.c           |  1 +
 arch/mips/kvm/mmu.c            |  9 +++++-
 arch/riscv/kvm/mmu.c           | 26 +++++++++++++-----
 arch/x86/kvm/mmu/mmu.c         | 16 +++++++++--
 arch/x86/kvm/mmu/tdp_mmu.c     | 16 +++++++++--
 drivers/base/node.c            |  2 ++
 fs/proc/meminfo.c              |  2 ++
 include/linux/kvm_host.h       |  9 ++++++
 include/linux/mmzone.h         |  1 +
 mm/memcontrol.c                |  1 +
 mm/page_alloc.c                |  6 +++-
 mm/vmstat.c                    |  1 +
 14 files changed, 111 insertions(+), 32 deletions(-)

-- 
2.36.0.rc2.479.g8af0fa9b8e-goog


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-04-28 23:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-26  5:38 [PATCH v3 0/6] KVM: mm: count KVM page table pages in memory stats Yosry Ahmed
2022-04-26  5:38 ` [PATCH v3 1/6] mm: add NR_SECONDARY_PAGETABLE stat Yosry Ahmed
2022-04-26  5:39 ` [PATCH v3 2/6] KVM: mmu: add a helper to account page table pages used by KVM Yosry Ahmed
2022-04-26  5:39 ` [PATCH v3 3/6] KVM: x86/mmu: count KVM page table pages in pagetable stats Yosry Ahmed
2022-04-26  5:39 ` [PATCH v3 4/6] KVM: arm64/mmu: " Yosry Ahmed
2022-04-26  7:34   ` Oliver Upton
2022-04-26 19:27     ` Yosry Ahmed
2022-04-28 17:45       ` Oliver Upton
2022-04-28 23:49         ` Yosry Ahmed
2022-04-26 15:58   ` Marc Zyngier
2022-04-26 19:33     ` Yosry Ahmed
2022-04-26  5:39 ` [PATCH v3 5/6] KVM: riscv/mmu: " Yosry Ahmed
2022-04-26  5:39 ` [PATCH v3 6/6] KVM: mips/mmu: " Yosry Ahmed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).