diff mbox series

Revert "KVM: Eliminate extra function calls in kvm_get_dirty_log_protect()"

Message ID 20190202092027.54890-1-Tianyu.Lan@microsoft.com (mailing list archive)
State New, archived
Headers show
Series Revert "KVM: Eliminate extra function calls in kvm_get_dirty_log_protect()" | expand

Commit Message

Tianyu Lan Feb. 2, 2019, 9:20 a.m. UTC
From: Lan Tianyu <Tianyu.Lan@microsoft.com>

The value of "dirty_bitmap[i]" is already check before setting its value
to mask. The following check of "mask" is redundant. The check of "mask" was
introduced by commit 58d2930f4ee3(("KVM: Eliminate extra function calls in
kvm_get_dirty_log_protect()"). This patch is to revert the patch.

Signed-off-by: Lan Tianyu <Tianyu.Lan@microsoft.com>
---
 virt/kvm/kvm_main.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Paolo Bonzini Feb. 14, 2019, 4:42 p.m. UTC | #1
On 02/02/19 10:20, lantianyu1986@gmail.com wrote:
> From: Lan Tianyu <Tianyu.Lan@microsoft.com>
> 
> The value of "dirty_bitmap[i]" is already check before setting its value
> to mask. The following check of "mask" is redundant. The check of "mask" was
> introduced by commit 58d2930f4ee3(("KVM: Eliminate extra function calls in
> kvm_get_dirty_log_protect()"). This patch is to revert the patch.
> 
> Signed-off-by: Lan Tianyu <Tianyu.Lan@microsoft.com>
> ---
>  virt/kvm/kvm_main.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 2bdc827b9ee9..ef06cfb9b52b 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1200,11 +1200,9 @@ int kvm_get_dirty_log_protect(struct kvm *kvm,
>  			mask = xchg(&dirty_bitmap[i], 0);
>  			dirty_bitmap_buffer[i] = mask;
>  
> -			if (mask) {
> -				offset = i * BITS_PER_LONG;
> -				kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot,
> -									offset, mask);
> -			}
> +			offset = i * BITS_PER_LONG;
> +			kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot,
> +								offset, mask);
>  		}
>  		spin_unlock(&kvm->mmu_lock);
>  	}
> 

Queued, thanks.

Paolo
diff mbox series

Patch

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 2bdc827b9ee9..ef06cfb9b52b 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1200,11 +1200,9 @@  int kvm_get_dirty_log_protect(struct kvm *kvm,
 			mask = xchg(&dirty_bitmap[i], 0);
 			dirty_bitmap_buffer[i] = mask;
 
-			if (mask) {
-				offset = i * BITS_PER_LONG;
-				kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot,
-									offset, mask);
-			}
+			offset = i * BITS_PER_LONG;
+			kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot,
+								offset, mask);
 		}
 		spin_unlock(&kvm->mmu_lock);
 	}