OSDN Git Service

kvm: x86: mmu: Make NX huge page recovery period configurable
authorJunaid Shahid <junaids@google.com>
Wed, 20 Oct 2021 01:06:27 +0000 (18:06 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 22 Oct 2021 09:19:28 +0000 (05:19 -0400)
commit4dfe4f40d845cdca655b27bf207959855f3e2d62
tree552cf71e45bec2a7bf0ce07519e5d10b3e75f236
parent540c7abe61cc5e81a3d17fe02bce94f6cbf9dce0
kvm: x86: mmu: Make NX huge page recovery period configurable

Currently, the NX huge page recovery thread wakes up every minute and
zaps 1/nx_huge_pages_recovery_ratio of the total number of split NX
huge pages at a time. This is intended to ensure that only a
relatively small number of pages get zapped at a time. But for very
large VMs (or more specifically, VMs with a large number of
executable pages), a period of 1 minute could still result in this
number being too high (unless the ratio is changed significantly,
but that can result in split pages lingering on for too long).

This change makes the period configurable instead of fixing it at
1 minute. Users of large VMs can then adjust the period and/or the
ratio to reduce the number of pages zapped at one time while still
maintaining the same overall duration for cycling through the
entire list. By default, KVM derives a period from the ratio such
that a page will remain on the list for 1 hour on average.

Signed-off-by: Junaid Shahid <junaids@google.com>
Message-Id: <20211020010627.305925-1-junaids@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Documentation/admin-guide/kernel-parameters.txt
arch/x86/kvm/mmu/mmu.c