From: NISHIGUCHI Naoki <nisiguti@jp.fujitsu.com>
To: George Dunlap <George.Dunlap@eu.citrix.com>,
xen-devel@lists.xensource.com
Cc: Ian.Pratt@eu.citrix.com, disheng.su@intel.com, keir.fraser@eu.citrix.com
Subject: Re: [RFC][PATCH 2/4] sched: change the handling of credits over upper bound
Date: Fri, 05 Dec 2008 19:09:45 +0900 [thread overview]
Message-ID: <4938FDE9.6050804@jp.fujitsu.com> (raw)
In-Reply-To: <4938FCFF.5060503@jp.fujitsu.com>
[-- Attachment #1: Type: text/plain, Size: 420 bytes --]
I forgot to attach.
NISHIGUCHI Naoki wrote:
> By applying this patch, the credit scheduler don't reset vcpu's credit
> (set to 0) when the credit would be over upper bound. And it prevents a
> vcpu from missing becoming active.
>
> Best regards,
> Naoki Nishiguchi
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
[-- Attachment #2: credit_preserve.patch --]
[-- Type: text/x-patch, Size: 4267 bytes --]
diff -r a00eb6595d3c xen/common/sched_credit.c
--- a/xen/common/sched_credit.c Sat Nov 29 09:07:52 2008 +0000
+++ b/xen/common/sched_credit.c Fri Dec 05 17:49:44 2008 +0900
@@ -196,6 +196,7 @@ struct csched_vcpu {
struct csched_vcpu {
struct list_head runq_elem;
struct list_head active_vcpu_elem;
+ struct list_head inactive_vcpu_elem;
struct csched_dom *sdom;
struct vcpu *vcpu;
atomic_t credit;
@@ -231,6 +232,7 @@ struct csched_private {
struct csched_private {
spinlock_t lock;
struct list_head active_sdom;
+ struct list_head inactive_vcpu;
uint32_t ncpus;
unsigned int master;
cpumask_t idlers;
@@ -484,12 +486,9 @@ csched_cpu_pick(struct vcpu *vc)
}
static inline void
-__csched_vcpu_acct_start(struct csched_vcpu *svc)
+__csched_vcpu_acct_start_locked(struct csched_vcpu *svc)
{
struct csched_dom * const sdom = svc->sdom;
- unsigned long flags;
-
- spin_lock_irqsave(&csched_priv.lock, flags);
if ( list_empty(&svc->active_vcpu_elem) )
{
@@ -498,13 +497,22 @@ __csched_vcpu_acct_start(struct csched_v
sdom->active_vcpu_count++;
list_add(&svc->active_vcpu_elem, &sdom->active_vcpu);
+ list_del_init(&svc->inactive_vcpu_elem);
if ( list_empty(&sdom->active_sdom_elem) )
{
list_add(&sdom->active_sdom_elem, &csched_priv.active_sdom);
csched_priv.weight += sdom->weight;
}
}
-
+}
+
+static inline void
+__csched_vcpu_acct_start(struct csched_vcpu *svc)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&csched_priv.lock, flags);
+ __csched_vcpu_acct_start_locked(svc);
spin_unlock_irqrestore(&csched_priv.lock, flags);
}
@@ -520,6 +528,7 @@ __csched_vcpu_acct_stop_locked(struct cs
sdom->active_vcpu_count--;
list_del_init(&svc->active_vcpu_elem);
+ list_add(&svc->inactive_vcpu_elem, &csched_priv.inactive_vcpu);
if ( list_empty(&sdom->active_vcpu) )
{
BUG_ON( csched_priv.weight < sdom->weight );
@@ -586,6 +595,7 @@ csched_vcpu_init(struct vcpu *vc)
INIT_LIST_HEAD(&svc->runq_elem);
INIT_LIST_HEAD(&svc->active_vcpu_elem);
+ INIT_LIST_HEAD(&svc->inactive_vcpu_elem);
svc->sdom = sdom;
svc->vcpu = vc;
atomic_set(&svc->credit, 0);
@@ -621,6 +631,9 @@ csched_vcpu_destroy(struct vcpu *vc)
if ( !list_empty(&svc->active_vcpu_elem) )
__csched_vcpu_acct_stop_locked(svc);
+
+ if ( !list_empty(&svc->inactive_vcpu_elem) )
+ list_del_init(&svc->inactive_vcpu_elem);
spin_unlock_irqrestore(&csched_priv.lock, flags);
@@ -839,6 +852,18 @@ csched_acct(void)
spin_lock_irqsave(&csched_priv.lock, flags);
+ /* Add vcpu to active list when its credit were consumed by one tick. */
+ list_for_each_safe( iter_vcpu, next_vcpu, &csched_priv.inactive_vcpu )
+ {
+ svc = list_entry(iter_vcpu, struct csched_vcpu, inactive_vcpu_elem);
+
+ if ( atomic_read(&svc->credit)
+ <= CSCHED_CREDITS_PER_TICK * (CSCHED_TICKS_PER_ACCT - 1) )
+ {
+ __csched_vcpu_acct_start_locked(svc);
+ }
+ }
+
weight_total = csched_priv.weight;
credit_total = csched_priv.credit;
@@ -995,7 +1020,7 @@ csched_acct(void)
if ( credit > CSCHED_CREDITS_PER_TSLICE )
{
__csched_vcpu_acct_stop_locked(svc);
- credit = 0;
+ credit = CSCHED_CREDITS_PER_TSLICE;
atomic_set(&svc->credit, credit);
}
}
@@ -1340,6 +1365,17 @@ csched_dump(void)
csched_dump_vcpu(svc);
}
}
+
+ printk("inactive vcpus:\n");
+ loop = 0;
+ list_for_each( iter_svc, &csched_priv.inactive_vcpu )
+ {
+ struct csched_vcpu *svc;
+ svc = list_entry(iter_svc, struct csched_vcpu, inactive_vcpu_elem);
+
+ printk("\t%3d: ", ++loop);
+ csched_dump_vcpu(svc);
+ }
}
static void
@@ -1347,6 +1383,7 @@ csched_init(void)
{
spin_lock_init(&csched_priv.lock);
INIT_LIST_HEAD(&csched_priv.active_sdom);
+ INIT_LIST_HEAD(&csched_priv.inactive_vcpu);
csched_priv.ncpus = 0;
csched_priv.master = UINT_MAX;
cpus_clear(csched_priv.idlers);
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2008-12-05 10:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-05 10:01 [RFC][PATCH 0/4] Modification of credit scheduler NISHIGUCHI Naoki
2008-12-05 10:05 ` [RFC][PATCH 1/4] sched: more accurate credit scheduling NISHIGUCHI Naoki
2008-12-05 10:05 ` [RFC][PATCH 2/4] sched: change the handling of credits over upper bound NISHIGUCHI Naoki
2008-12-05 10:09 ` NISHIGUCHI Naoki [this message]
2008-12-05 10:07 ` [RFC][PATCH 3/4] sched: balance credits of each vcpu of a domain NISHIGUCHI Naoki
2008-12-08 8:53 ` [RFC][PATCH 4/4] sched: introduce boost credit for latency-sensitive domain NISHIGUCHI Naoki
-- strict thread matches above, loose matches on Subject: below --
2008-12-18 2:57 [RFC][PATCH 0/4] Modification of credit scheduler rev2 NISHIGUCHI Naoki
2008-12-18 3:02 ` [RFC][PATCH 2/4] sched: change the handling of credits over upper bound NISHIGUCHI Naoki
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=4938FDE9.6050804@jp.fujitsu.com \
--to=nisiguti@jp.fujitsu.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=Ian.Pratt@eu.citrix.com \
--cc=disheng.su@intel.com \
--cc=keir.fraser@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.