From: Takuya Yoshikawa Date: Fri, 23 Apr 2010 08:48:35 +0000 (+0900) Subject: KVM: Remove test-before-set optimization for dirty bits X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d14769377a247d4e7b570592a090474c8a059938;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git KVM: Remove test-before-set optimization for dirty bits As Avi pointed out, testing bit part in mark_page_dirty() was important in the days of shadow paging, but currently EPT and NPT has already become common and the chance of faulting a page more that once per iteration is small. So let's remove the test bit to avoid extra access. Signed-off-by: Takuya Yoshikawa Signed-off-by: Avi Kivity --- diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 6dc940455e8b..9ab1a77941ef 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1192,9 +1192,7 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn) if (memslot && memslot->dirty_bitmap) { unsigned long rel_gfn = gfn - memslot->base_gfn; - /* avoid RMW */ - if (!generic_test_le_bit(rel_gfn, memslot->dirty_bitmap)) - generic___set_le_bit(rel_gfn, memslot->dirty_bitmap); + generic___set_le_bit(rel_gfn, memslot->dirty_bitmap); } }