]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: MMU: cleanup for __mmu_unsync_walk()
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Fri, 11 Jun 2010 13:32:34 +0000 (21:32 +0800)
committerMarcelo Tosatti <mtosatti@redhat.com>
Mon, 14 Jun 2010 22:06:02 +0000 (19:06 -0300)
Decrease sp->unsync_children after clear unsync_child_bitmap bit

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/mmu.c

index 8bfcb32a06e75ac6173315f521d67918d64b1940..6230c386374e50257586f0ccd3a5b474a7f04115 100644 (file)
@@ -1160,9 +1160,11 @@ static int __mmu_unsync_walk(struct kvm_mmu_page *sp,
                                        return -ENOSPC;
 
                                ret = __mmu_unsync_walk(child, pvec);
-                               if (!ret)
+                               if (!ret) {
                                        __clear_bit(i, sp->unsync_child_bitmap);
-                               else if (ret > 0)
+                                       sp->unsync_children--;
+                                       WARN_ON((int)sp->unsync_children < 0);
+                               } else if (ret > 0)
                                        nr_unsync_leaf += ret;
                                else
                                        return ret;
@@ -1176,8 +1178,6 @@ static int __mmu_unsync_walk(struct kvm_mmu_page *sp,
                }
        }
 
-       if (find_first_bit(sp->unsync_child_bitmap, 512) == 512)
-               sp->unsync_children = 0;
 
        return nr_unsync_leaf;
 }