From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xen.org, jbeulich@suse.com,
alan.robinson@ts.fujitsu.com, george.dunlap@eu.citrix.com,
dario.faggioli@citrix.com
Cc: Juergen Gross <jgross@suse.com>
Subject: [PATCH v2 1/2] xen: update timeslice under lock
Date: Tue, 2 Feb 2016 12:29:41 +0100 [thread overview]
Message-ID: <1454412582-3263-2-git-send-email-jgross@suse.com> (raw)
In-Reply-To: <1454412582-3263-1-git-send-email-jgross@suse.com>
When updating the timeslice of the credit scheduler protect the
scheduler's private data by it's lock. Today a possible race could
result only in some weird scheduling decisions during one timeslice,
but further adjustments will need the lock anyway.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
xen/common/sched_credit.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index 03fb2c2..8fbbd54 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -1101,6 +1101,7 @@ csched_sys_cntl(const struct scheduler *ops,
int rc = -EINVAL;
xen_sysctl_credit_schedule_t *params = &sc->u.sched_credit;
struct csched_private *prv = CSCHED_PRIV(ops);
+ unsigned long flags;
switch ( sc->cmd )
{
@@ -1112,8 +1113,12 @@ csched_sys_cntl(const struct scheduler *ops,
|| params->ratelimit_us < XEN_SYSCTL_SCHED_RATELIMIT_MIN))
|| MICROSECS(params->ratelimit_us) > MILLISECS(params->tslice_ms) )
goto out;
+
+ spin_lock_irqsave(&prv->lock, flags);
__csched_set_tslice(prv, params->tslice_ms);
prv->ratelimit_us = params->ratelimit_us;
+ spin_unlock_irqrestore(&prv->lock, flags);
+
/* FALLTHRU */
case XEN_SYSCTL_SCHEDOP_getinfo:
params->tslice_ms = prv->tslice_ms;
--
2.6.2
next prev parent reply other threads:[~2016-02-02 11:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 11:29 [PATCH v2 0/2] xen: correct changing credit scheduler's timeslice Juergen Gross
2016-02-02 11:29 ` Juergen Gross [this message]
2016-02-02 11:29 ` [PATCH v2 2/2] xen: recalculate per-cpupool credits when updating timeslice Juergen Gross
2016-02-02 12:14 ` [PATCH v2 0/2] xen: correct changing credit scheduler's timeslice 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=1454412582-3263-2-git-send-email-jgross@suse.com \
--to=jgross@suse.com \
--cc=alan.robinson@ts.fujitsu.com \
--cc=dario.faggioli@citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=xen-devel@lists.xen.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).