* [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
* Re: [PATCH] KVM: avoid unnecessary synchronize_rcu
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
1 sibling, 0 replies; 4+ messages in thread
From: Raghavendra K T @ 2014-08-19 15:03 UTC (permalink / raw)
To: Christian Borntraeger; +Cc: Paolo Bonzini, KVM, Gleb Natapov, riel, dahi
On 08/19/2014 08:15 PM, Christian Borntraeger wrote:
> 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>
Feel free to add:
Reviewed-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: avoid unnecessary synchronize_rcu
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
1 sibling, 1 reply; 4+ messages in thread
From: Christian Borntraeger @ 2014-08-25 8:24 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: KVM, Gleb Natapov, raghavendra.kt, riel, dahi
On 19/08/14 16:45, Christian Borntraeger wrote:
> 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();
>
Ping.
That variant should be enough for us for future QEMUs. David has prepared some patches in QEMU that makes the other problems go away (mostly) which are currently under internal review/test.
Let me know if you want to have the put_pid inside the if as well (or feel free to fix up yourself code and patch description).
Thanks
Christian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: avoid unnecessary synchronize_rcu
2014-08-25 8:24 ` Christian Borntraeger
@ 2014-08-25 8:27 ` Christian Borntraeger
0 siblings, 0 replies; 4+ messages in thread
From: Christian Borntraeger @ 2014-08-25 8:27 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: KVM, Gleb Natapov, raghavendra.kt, riel, dahi
On 25/08/14 10:24, Christian Borntraeger wrote:
> On 19/08/14 16:45, Christian Borntraeger wrote:
>> 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();
>>
>
> Ping.
> That variant should be enough for us for future QEMUs. David has prepared some patches in QEMU that makes the other problems go away (mostly) which are currently under internal review/test.
> Let me know if you want to have the put_pid inside the if as well (or feel free to fix up yourself code and patch description).
>
> Thanks
Just updated kvm/next. Sorry for the noise.
^ permalink raw reply [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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.