From: Paolo Bonzini <pbonzini@redhat.com>
To: Vipin Sharma <vipinsh@google.com>
Cc: seanjc@google.com, vkuznets@redhat.com, wanpengli@tencent.com,
jmattson@google.com, joro@8bytes.org, dmatlack@google.com,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] KVM: x86/mmu: Speed up slot_rmap_walk_next for sparsely populated rmaps
Date: Tue, 3 May 2022 11:32:30 +0200 [thread overview]
Message-ID: <fa567ab7-bf5d-3c95-aea8-2dcba00d50cd@redhat.com> (raw)
In-Reply-To: <20220502220347.174664-1-vipinsh@google.com>
On 5/3/22 00:03, Vipin Sharma wrote:
> Avoid calling handlers on empty rmap entries and skip to the next non
> empty rmap entry.
>
> Empty rmap entries are noop in handlers.
>
> Signed-off-by: Vipin Sharma <vipinsh@google.com>
> Suggested-by: Sean Christopherson <seanjc@google.com>
> ---
>
> v2:
> - Removed noinline from slot_rmap_walk_next signature
>
> v1:
> - https://lore.kernel.org/lkml/20220325233125.413634-1-vipinsh@google.com
>
> arch/x86/kvm/mmu/mmu.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index 77785587332e..4e8d546431eb 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -1501,9 +1501,11 @@ static bool slot_rmap_walk_okay(struct slot_rmap_walk_iterator *iterator)
>
> static void slot_rmap_walk_next(struct slot_rmap_walk_iterator *iterator)
> {
> - if (++iterator->rmap <= iterator->end_rmap) {
> + while (++iterator->rmap <= iterator->end_rmap) {
> iterator->gfn += (1UL << KVM_HPAGE_GFN_SHIFT(iterator->level));
> - return;
> +
> + if (iterator->rmap->val)
> + return;
> }
>
> if (++iterator->level > iterator->end_level) {
>
> base-commit: 71d7c575a673d42ad7175ad5fc27c85c80330311
Queued, thanks.
Paolo
prev parent reply other threads:[~2022-05-03 9:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-02 22:03 Vipin Sharma
2022-05-03 9:32 ` Paolo Bonzini [this message]
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=fa567ab7-bf5d-3c95-aea8-2dcba00d50cd@redhat.com \
--to=pbonzini@redhat.com \
--cc=dmatlack@google.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=seanjc@google.com \
--cc=vipinsh@google.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
/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
all inboxes | Powered by JetHome®