[Devel] [PATCH 2/2] kvm: Allow scheduler throttling in __vcpu_run()

Kirill Tkhai ktkhai at virtuozzo.com
Mon Jan 11 09:15:57 PST 2016


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 <ktkhai at virtuozzo.com>
---
 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);
 		}
 	}



More information about the Devel mailing list