From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
Dario Faggioli <raistlin@linux.it>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v2] sched/null: skip vCPUs on the waitqueue that are blocked
Date: Fri, 29 Dec 2017 12:50:56 +0000 [thread overview]
Message-ID: <20171229125056.14244-1-roger.pau@citrix.com> (raw)
Avoid scheduling vCPUs that are blocked, there's no point in assigning
them to a pCPU because they are not going to run anyway.
Since blocked vCPUs are not assigned to pCPUs after this change, force
a rescheduling when a vCPU is brought up if it's on the waitqueue.
Also when scheduling try to pick a vCPU from the runqueue if the pCPU
is running idle.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Dario Faggioli <raistlin@linux.it>
---
Changes since v1:
- Force a rescheduling when a vCPU is brought up.
- Try to pick a vCPU from the runqueue if running the idle vCPU.
---
xen/common/sched_null.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/xen/common/sched_null.c b/xen/common/sched_null.c
index b4a24baf8e..bacfb31cb3 100644
--- a/xen/common/sched_null.c
+++ b/xen/common/sched_null.c
@@ -574,6 +574,8 @@ static void null_vcpu_wake(const struct scheduler *ops, struct vcpu *v)
{
/* Not exactly "on runq", but close enough for reusing the counter */
SCHED_STAT_CRANK(vcpu_wake_onrunq);
+ /* Force a rescheduling in case some CPU is idle can pick this vCPU */
+ cpumask_raise_softirq(&cpu_online_map, SCHEDULE_SOFTIRQ);
return;
}
@@ -761,9 +763,10 @@ static struct task_slice null_schedule(const struct scheduler *ops,
/*
* We may be new in the cpupool, or just coming back online. In which
* case, there may be vCPUs in the waitqueue that we can assign to us
- * and run.
+ * and run. Also check whether this CPU is running idle, in which case try
+ * to pick a vCPU from the waitqueue.
*/
- if ( unlikely(ret.task == NULL) )
+ if ( unlikely(ret.task == NULL || ret.task == idle_vcpu[cpu]) )
{
spin_lock(&prv->waitq_lock);
@@ -781,6 +784,10 @@ static struct task_slice null_schedule(const struct scheduler *ops,
{
list_for_each_entry( wvc, &prv->waitq, waitq_elem )
{
+ if ( test_bit(_VPF_down, &wvc->vcpu->pause_flags) )
+ /* Skip vCPUs that are down. */
+ continue;
+
if ( bs == BALANCE_SOFT_AFFINITY &&
!has_soft_affinity(wvc->vcpu, wvc->vcpu->cpu_hard_affinity) )
continue;
--
2.15.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
reply other threads:[~2017-12-29 12:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20171229125056.14244-1-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=raistlin@linux.it \
--cc=xen-devel@lists.xenproject.org \
/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).