xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen: recalculate per-cpupool credits when updating timeslice
@ 2016-01-29 10:21 Juergen Gross
  2016-01-29 10:46 ` Jan Beulich
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Juergen Gross @ 2016-01-29 10:21 UTC (permalink / raw)
  To: xen-devel, jbeulich, george.dunlap, dario.faggioli; +Cc: Juergen Gross

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 <jgross@suse.com>
---
 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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-02 11:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-29 10:21 [PATCH] xen: recalculate per-cpupool credits when updating timeslice Juergen Gross
2016-01-29 10:46 ` Jan Beulich
     [not found] ` <56AB511402000078000CC59C@suse.com>
2016-01-29 10:59   ` Juergen Gross
2016-02-02  9:53     ` Dario Faggioli
2016-02-02 10:35       ` Juergen Gross
2016-02-02 11:33         ` Dario Faggioli
2016-02-02  7:55 ` Alan Robinson

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).