KVM: x86/mmu: count KVM mmu usage in secondary pagetable stats.
authorYosry Ahmed <yosryahmed@google.com>
Tue, 23 Aug 2022 00:46:37 +0000 (00:46 +0000)
committerSean Christopherson <seanjc@google.com>
Tue, 30 Aug 2022 14:41:12 +0000 (07:41 -0700)
commit43a063cab325ee7cc50349967e536b3cd4e57f03
treeef1028659ec2f62930896e5d56eb54b0e46c612f
parentebc97a52b5d6cd5fb0c15a3fc9cdd6eb924646a1
KVM: x86/mmu: count KVM mmu usage in secondary pagetable stats.

Count the pages used by KVM mmu on x86 in memory stats under secondary
pagetable stats (e.g. "SecPageTables" in /proc/meminfo) to give better
visibility into the memory consumption of KVM mmu in a similar way to
how normal user page tables are accounted.

Add the inner helper in common KVM, ARM will also use it to count stats
in a future commit.

Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Acked-by: Marc Zyngier <maz@kernel.org> # generic KVM changes
Link: https://lore.kernel.org/r/20220823004639.2387269-3-yosryahmed@google.com
Link: https://lore.kernel.org/r/20220823004639.2387269-4-yosryahmed@google.com
[sean: squash x86 usage to workaround modpost issues]
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/tdp_mmu.c
include/linux/kvm_host.h