Since __vcpu_run() does not hold any mutexes, it's
save to throttle there.

Otherwise, the character of this place makes it behave
as in-kernel busy loop: while () { cond_resched(); }
and sys cpu usage takes up to 100% cpu.

https://jira.sw.ru/browse/PSBM-42358

Signed-off-by: Kirill Tkhai <[email protected]>
---
 arch/x86/kvm/x86.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index db1017b..ac64018 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6006,7 +6006,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
                }
                if (need_resched()) {
                        srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);
-                       cond_resched();
+                       cond_resched_may_throttle();
                        vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
                }
        }

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to