aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Borntraeger <borntraeger@de.ibm.com>2014-08-19 16:45:56 +0200
committerChristoffer Dall <christoffer.dall@linaro.org>2014-10-02 17:19:10 +0200
commit7fdbe25673a0bcd4c38968ec2cd048a21f1fbb93 (patch)
tree1067d0a66a99822d018843eab298950db1c0b388
parent57f984d2c64c8c1e597d021567a379f4f3920b35 (diff)
KVM: avoid unnecessary synchronize_rcu
We dont have to wait for a grace period if there is no oldpid that we are going to free. putpid also checks for NULL, so this patch only fences synchronize_rcu. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 7103f60de8bed21a0ad5d15d2ad5b7a333dda201) Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
-rw-r--r--virt/kvm/kvm_main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 50f947301fa7..aa5057e7a1b9 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -129,7 +129,8 @@ int vcpu_load(struct kvm_vcpu *vcpu)
struct pid *oldpid = vcpu->pid;
struct pid *newpid = get_task_pid(current, PIDTYPE_PID);
rcu_assign_pointer(vcpu->pid, newpid);
- synchronize_rcu();
+ if (oldpid)
+ synchronize_rcu();
put_pid(oldpid);
}
cpu = get_cpu();