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>
Message-Id: <
20220502220347.174664-1-vipinsh@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
 
 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) {