OSDN Git Service

KVM: arm64: Walk userspace page tables to compute the THP mapping size
authorMarc Zyngier <maz@kernel.org>
Mon, 26 Jul 2021 15:35:48 +0000 (16:35 +0100)
committerMarc Zyngier <maz@kernel.org>
Mon, 2 Aug 2021 13:05:58 +0000 (14:05 +0100)
commit6011cf68c88545e16cb32039c2cecfdae6a32315
tree53d6a98d92746dd99f9da83062e68db9caf0b60a
parent63db506e07622c344a3c748a1c06293d48780f83
KVM: arm64: Walk userspace page tables to compute the THP mapping size

We currently rely on the kvm_is_transparent_hugepage() helper to
discover whether a given page has the potential to be mapped as
a block mapping.

However, this API doesn't really give un everything we want:
- we don't get the size: this is not crucial today as we only
  support PMD-sized THPs, but we'd like to have larger sizes
  in the future
- we're the only user left of the API, and there is a will
  to remove it altogether

To address the above, implement a simple walker using the existing
page table infrastructure, and plumb it into transparent_hugepage_adjust().
No new page sizes are supported in the process.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Link: https://lore.kernel.org/r/20210726153552.1535838-3-maz@kernel.org
arch/arm64/kvm/mmu.c