From: Anthony Yznaga <anthony.yznaga@oracle.com>
To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: pbonzini@redhat.com, sean.j.christopherson@intel.com,
vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com,
joro@8bytes.org, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, x86@kernel.org, hpa@zytor.com,
steven.sistare@oracle.com, anthony.yznaga@oracle.com
Subject: [PATCH 2/3] KVM: x86: avoid unnecessary rmap walks when creating/moving slots
Date: Tue, 2 Jun 2020 13:07:29 -0700 [thread overview]
Message-ID: <1591128450-11977-3-git-send-email-anthony.yznaga@oracle.com> (raw)
In-Reply-To: <1591128450-11977-1-git-send-email-anthony.yznaga@oracle.com>
On large memory guests it has been observed that creating a memslot
for a very large range can take noticeable amount of time.
Investigation showed that the time is spent walking the rmaps to update
existing sptes to remove write access or set/clear dirty bits to support
dirty logging. These rmap walks are unnecessary when creating or moving
a memslot. A newly created memslot will not have any existing mappings,
and the existing mappings of a moved memslot will have been invalidated
and flushed. Any mappings established once the new/moved memslot becomes
visible will be set using the properties of the new slot.
Signed-off-by: Anthony Yznaga <anthony.yznaga@oracle.com>
---
arch/x86/kvm/x86.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 23fd888e52ee..d211c8ced6bb 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -10138,7 +10138,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
*
* FIXME: const-ify all uses of struct kvm_memory_slot.
*/
- if (change != KVM_MR_DELETE)
+ if (change == KVM_MR_FLAGS_ONLY)
kvm_mmu_slot_apply_flags(kvm, (struct kvm_memory_slot *) new);
/* Free the arrays associated with the old memslot. */
--
2.13.3
next prev parent reply other threads:[~2020-06-02 20:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-02 20:07 [PATCH 0/3] avoid unnecessary memslot rmap walks Anthony Yznaga
2020-06-02 20:07 ` [PATCH 1/3] KVM: x86: remove unnecessary rmap walk of read-only memslots Anthony Yznaga
2020-06-02 20:07 ` Anthony Yznaga [this message]
2020-06-02 20:07 ` [PATCH 3/3] KVM: x86: minor code refactor and comments fixup around dirty logging Anthony Yznaga
2020-06-04 18:42 ` [PATCH 0/3] avoid unnecessary memslot rmap walks Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1591128450-11977-3-git-send-email-anthony.yznaga@oracle.com \
--to=anthony.yznaga@oracle.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=steven.sistare@oracle.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).