From: Venkatesh Srinivas <venkateshs@chromium.org>
To: kvm@vger.kernel.org, jmattson@google.com, pbonzini@redhat.com,
dmatlack@google.com
Cc: Benjamin Segall <bsegall@google.com>,
Venkatesh Srinivas <venkateshs@chromium.org>
Subject: [PATCH] kvm: exit halt polling on need_resched() as well
Date: Thu, 29 Apr 2021 16:22:34 +0000 [thread overview]
Message-ID: <20210429162233.116849-1-venkateshs@chromium.org> (raw)
From: Benjamin Segall <bsegall@google.com>
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: Ben Segall <bsegall@google.com>
Signed-off-by: Venkatesh Srinivas <venkateshs@chromium.org>
---
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 2799c6660cce..b9f12da6af0e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2973,7 +2973,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
goto out;
}
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);
--
2.31.1.498.g6c1eba8ee3d-goog
next reply other threads:[~2021-04-29 16:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 16:22 Venkatesh Srinivas [this message]
2021-04-29 16:39 ` [PATCH] kvm: exit halt polling on need_resched() as well Jim Mattson
2021-04-30 15:48 ` David Matlack
2021-04-30 17:43 ` Christian Borntraeger
2021-05-03 14:52 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210429162233.116849-1-venkateshs@chromium.org \
--to=venkateshs@chromium.org \
--cc=bsegall@google.com \
--cc=dmatlack@google.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).