diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2010-04-27 05:11:07 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-04-27 05:11:07 -0400 |
commit | 846bcf3923056965c3fc0c9ba811c10d25af75e5 (patch) | |
tree | c39bd4273a006da2fb1f727ebb7eb1108f5526c8 /virt | |
parent | 863c3ad87b10617464fc52c21fc7e31987910559 (diff) | |
parent | 3e7ad8ed979ce9e3ad897dd87c50bf577966f89c (diff) |
Merge branch 'master' of
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.33.y
into rt/2.6.33
Conflicts:
Makefile
arch/x86/include/asm/rwsem.h
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 6d0e484b40f3..bb06fca047f2 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -638,7 +638,7 @@ skip_lpage: | |||
638 | 638 | ||
639 | /* Allocate page dirty bitmap if needed */ | 639 | /* Allocate page dirty bitmap if needed */ |
640 | if ((new.flags & KVM_MEM_LOG_DIRTY_PAGES) && !new.dirty_bitmap) { | 640 | if ((new.flags & KVM_MEM_LOG_DIRTY_PAGES) && !new.dirty_bitmap) { |
641 | unsigned dirty_bytes = ALIGN(npages, BITS_PER_LONG) / 8; | 641 | unsigned long dirty_bytes = kvm_dirty_bitmap_bytes(&new); |
642 | 642 | ||
643 | new.dirty_bitmap = vmalloc(dirty_bytes); | 643 | new.dirty_bitmap = vmalloc(dirty_bytes); |
644 | if (!new.dirty_bitmap) | 644 | if (!new.dirty_bitmap) |
@@ -721,7 +721,7 @@ int kvm_get_dirty_log(struct kvm *kvm, | |||
721 | { | 721 | { |
722 | struct kvm_memory_slot *memslot; | 722 | struct kvm_memory_slot *memslot; |
723 | int r, i; | 723 | int r, i; |
724 | int n; | 724 | unsigned long n; |
725 | unsigned long any = 0; | 725 | unsigned long any = 0; |
726 | 726 | ||
727 | r = -EINVAL; | 727 | r = -EINVAL; |
@@ -733,7 +733,7 @@ int kvm_get_dirty_log(struct kvm *kvm, | |||
733 | if (!memslot->dirty_bitmap) | 733 | if (!memslot->dirty_bitmap) |
734 | goto out; | 734 | goto out; |
735 | 735 | ||
736 | n = ALIGN(memslot->npages, BITS_PER_LONG) / 8; | 736 | n = kvm_dirty_bitmap_bytes(memslot); |
737 | 737 | ||
738 | for (i = 0; !any && i < n/sizeof(long); ++i) | 738 | for (i = 0; !any && i < n/sizeof(long); ++i) |
739 | any = memslot->dirty_bitmap[i]; | 739 | any = memslot->dirty_bitmap[i]; |
@@ -1075,10 +1075,13 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn) | |||
1075 | memslot = gfn_to_memslot_unaliased(kvm, gfn); | 1075 | memslot = gfn_to_memslot_unaliased(kvm, gfn); |
1076 | if (memslot && memslot->dirty_bitmap) { | 1076 | if (memslot && memslot->dirty_bitmap) { |
1077 | unsigned long rel_gfn = gfn - memslot->base_gfn; | 1077 | unsigned long rel_gfn = gfn - memslot->base_gfn; |
1078 | unsigned long *p = memslot->dirty_bitmap + | ||
1079 | rel_gfn / BITS_PER_LONG; | ||
1080 | int offset = rel_gfn % BITS_PER_LONG; | ||
1078 | 1081 | ||
1079 | /* avoid RMW */ | 1082 | /* avoid RMW */ |
1080 | if (!generic_test_le_bit(rel_gfn, memslot->dirty_bitmap)) | 1083 | if (!generic_test_le_bit(offset, p)) |
1081 | generic___set_le_bit(rel_gfn, memslot->dirty_bitmap); | 1084 | generic___set_le_bit(offset, p); |
1082 | } | 1085 | } |
1083 | } | 1086 | } |
1084 | 1087 | ||