From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juergen Gross Subject: [PATCH] xen: recalculate per-cpupool credits when updating timeslice Date: Fri, 29 Jan 2016 11:21:48 +0100 Message-ID: <1454062908-32013-1-git-send-email-jgross@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org, jbeulich@suse.com, george.dunlap@eu.citrix.com, dario.faggioli@citrix.com Cc: Juergen Gross List-Id: xen-devel@lists.xenproject.org When modifying the timeslice of the credit scheduler in a cpupool the cpupool global credit value (n_cpus * credits_per_tslice) isn't recalculated. This will lead to wrong scheduling decisions later. Do the recalculation when updating the timeslice. Signed-off-by: Juergen Gross --- xen/common/sched_credit.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 03fb2c2..912511e 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -1086,12 +1086,19 @@ csched_dom_cntl( static inline void __csched_set_tslice(struct csched_private *prv, unsigned timeslice) { + unsigned long flags; + + spin_lock_irqsave(&prv->lock, flags); + prv->tslice_ms = timeslice; prv->ticks_per_tslice = CSCHED_TICKS_PER_TSLICE; if ( prv->tslice_ms < prv->ticks_per_tslice ) prv->ticks_per_tslice = 1; prv->tick_period_us = prv->tslice_ms * 1000 / prv->ticks_per_tslice; prv->credits_per_tslice = CSCHED_CREDITS_PER_MSEC * prv->tslice_ms; + prv->credit = prv->credits_per_tslice * prv->ncpus; + + spin_unlock_irqrestore(&prv->lock, flags); } static int -- 2.6.2