Skip to content

Commit

Permalink
KVM: Remove test-before-set optimization for dirty bits
Browse files Browse the repository at this point in the history
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 <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
  • Loading branch information
Takuya Yoshikawa authored and Avi Kivity committed May 17, 2010
1 parent 0390918 commit d147693
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit d147693

Please sign in to comment.