From: Dario Faggioli <dario.faggioli@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Subject: [PATCH 3/3] xen: credit1: avoid boosting vCPUs being "just" migrated
Date: Thu, 11 Feb 2016 12:39:01 +0100 [thread overview]
Message-ID: <20160211113901.20959.87801.stgit@Solace.station> (raw)
In-Reply-To: <20160211113321.20959.53804.stgit@Solace.station>
Moving a vCPU to a different pCPU means blocking it and
waking it up (on the new pCPU). Credit1 grants BOOST
priority to vCPUs that wakes up, with the aim of improving
I/O latency. The end result is that vCPUs get boosted when
migrating, which shouldn't happen.
For instance, this causes scheduling anomalies and,
potentially, performance problems, as reported here:
http://lists.xen.org/archives/html/xen-devel/2015-10/msg02851.html
This patch fixes things by introducing a new wakeup flag,
and using it to tag the wakeups that happens because of
migrations (and avoid boosting, in these cases).
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
---
xen/common/sched_credit.c | 11 +++++++----
xen/common/schedule.c | 4 ++--
xen/include/xen/sched.h | 3 +++
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index f728ddd..2a23a0b 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -1022,11 +1022,14 @@ csched_vcpu_wake(const struct scheduler *ops, struct vcpu *vc, unsigned wf)
* more CPU resource intensive VCPUs without impacting overall
* system fairness.
*
- * The one exception is for VCPUs of capped domains unpausing
- * after earning credits they had overspent. We don't boost
- * those.
+ * There are a couple of exceptions, when we don't want to boost:
+ * - VCPUs that are waking up after a migration, rather than
+ * after having block;
+ * - VCPUs of capped domains unpausing after earning credits
+ * they had overspent.
*/
- if ( svc->pri == CSCHED_PRI_TS_UNDER &&
+ if ( !(wf & WF_migrated) &&
+ svc->pri == CSCHED_PRI_TS_UNDER &&
!test_bit(CSCHED_FLAG_VCPU_PARKED, &svc->flags) )
{
TRACE_2D(TRC_CSCHED_BOOST_START, vc->domain->domain_id, vc->vcpu_id);
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index ea74c96..c9a4f52 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -581,8 +581,8 @@ static void vcpu_migrate(struct vcpu *v)
if ( old_cpu != new_cpu )
sched_move_irqs(v);
- /* Wake on new CPU. */
- vcpu_wake(v);
+ /* Wake on new CPU (and let the scheduler know it's a migration). */
+ _vcpu_wake(v, WF_migrated);
}
/*
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 9fdcfff..5f426ad 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -764,6 +764,9 @@ static inline struct domain *next_domain_in_cpupool(
/* 'Default' wakeup. */
#define _WF_wakeup 0
#define WF_wakeup (1U<<_WF_wakeup)
+/* Post-migration wakeup. */
+#define _WF_migrated 1
+#define WF_migrated (1U<<_WF_migrated)
static inline int vcpu_runnable(struct vcpu *v)
{
next prev parent reply other threads:[~2016-02-11 11:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-11 11:38 [PATCH 0/3] xen: sched: Credit1 shouldn't boost vcpus being migrated Dario Faggioli
2016-02-11 11:38 ` [PATCH 1/3] xen: credit1: trace vCPU boost/unboost Dario Faggioli
2016-02-11 11:38 ` [PATCH 2/3] xen: sched: add wakeup flags to the scheduler interface Dario Faggioli
2016-02-11 13:24 ` Jan Beulich
2016-02-11 17:46 ` Dario Faggioli
2016-02-11 11:39 ` Dario Faggioli [this message]
2016-02-11 13:30 ` [PATCH 3/3] xen: credit1: avoid boosting vCPUs being "just" migrated Jan Beulich
2016-02-11 17:45 ` Dario Faggioli
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=20160211113901.20959.87801.stgit@Solace.station \
--to=dario.faggioli@citrix.com \
--cc=george.dunlap@eu.citrix.com \
--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).