提交 fab87379 编写于 作者: B Benjamin Segall 提交者: Zheng Zengkai

kvm: exit halt polling on need_resched() as well

stable inclusion
from stable-5.10.38
commit ce7639252357be0e1f93a77abd6d81f39c800a91
bugzilla: 51875
CVE: NA

--------------------------------

commit 262de410 upstream.

single_task_running() is usually more general than need_resched()
but CFS_BANDWIDTH throttling will use resched_task() when there
is just one task to get the task to block. This was causing
long-need_resched warnings and was likely allowing VMs to
overrun their quota when halt polling.
Signed-off-by: NBen Segall <bsegall@google.com>
Signed-off-by: NVenkatesh Srinivas <venkateshs@chromium.org>
Message-Id: <20210429162233.116849-1-venkateshs@chromium.org>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Cc: stable@vger.kernel.org
Reviewed-by: NJim Mattson <jmattson@google.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 02fb3b39
...@@ -2805,7 +2805,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) ...@@ -2805,7 +2805,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
goto out; goto out;
} }
poll_end = cur = ktime_get(); poll_end = cur = ktime_get();
} while (single_task_running() && ktime_before(cur, stop)); } while (single_task_running() && !need_resched() &&
ktime_before(cur, stop));
} }
prepare_to_rcuwait(&vcpu->wait); prepare_to_rcuwait(&vcpu->wait);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册