public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: avoid unnecessary synchronize_rcu
@ 2014-08-19 14:45 Christian Borntraeger
  2014-08-19 15:03 ` Raghavendra K T
  2014-08-25  8:24 ` Christian Borntraeger
  0 siblings, 2 replies; 4+ messages in thread
From: Christian Borntraeger @ 2014-08-19 14:45 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: KVM, Gleb Natapov, raghavendra.kt, riel, dahi,
	Christian Borntraeger

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>
---
 virt/kvm/kvm_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 33712fb..39b1603 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();
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-25  8:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-19 14:45 [PATCH] KVM: avoid unnecessary synchronize_rcu Christian Borntraeger
2014-08-19 15:03 ` Raghavendra K T
2014-08-25  8:24 ` Christian Borntraeger
2014-08-25  8:27   ` Christian Borntraeger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox