Commit d14769377a247d4e7b570592a090474c8a059938
Committed by
Avi Kivity
1 parent
039091875c
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 <yoshikawa.takuya@oss.ntt.co.jp> Signed-off-by: Avi Kivity <avi@redhat.com>
Showing 1 changed file with 1 additions and 3 deletions Side-by-side Diff
virt/kvm/kvm_main.c
... | ... | @@ -1192,9 +1192,7 @@ |
1192 | 1192 | if (memslot && memslot->dirty_bitmap) { |
1193 | 1193 | unsigned long rel_gfn = gfn - memslot->base_gfn; |
1194 | 1194 | |
1195 | - /* avoid RMW */ | |
1196 | - if (!generic_test_le_bit(rel_gfn, memslot->dirty_bitmap)) | |
1197 | - generic___set_le_bit(rel_gfn, memslot->dirty_bitmap); | |
1195 | + generic___set_le_bit(rel_gfn, memslot->dirty_bitmap); | |
1198 | 1196 | } |
1199 | 1197 | } |
1200 | 1198 |