All of lore.kernel.org
 help / color / mirror / Atom feed
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, aviv@neocleus.com,
	keir.fraser@eu.citrix.com, sakaia@jp.fujitsu.com
Subject: [RFC][PATCH 3/4] sched: balance credits of each vcpu of a domain
Date: Thu, 18 Dec 2008 12:04:08 +0900	[thread overview]
Message-ID: <4949BDA8.7000305@jp.fujitsu.com> (raw)
In-Reply-To: <4949BC2C.4060302@jp.fujitsu.com>

[-- Attachment #1: Type: text/plain, Size: 163 bytes --]

By applying this patch, the credit scheduler balances credits of each 
active vcpu of a domain.

There is no change in this patch.

Best regards,
Naoki Nishiguchi

[-- Attachment #2: credit_rev2_3_balance.patch --]
[-- Type: text/x-patch, Size: 1565 bytes --]

diff -r 1aec7bbd0ffc xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Wed Dec 17 16:01:52 2008 +0900
+++ b/xen/common/sched_credit.c	Wed Dec 17 16:02:29 2008 +0900
@@ -838,7 +838,8 @@ csched_acct(void)
     int credit_balance;
     int credit_xtra;
     int credit;
-
+    int64_t credit_sum;
+    int credit_average;
 
     spin_lock_irqsave(&csched_priv.lock, flags);
 
@@ -887,6 +888,18 @@ csched_acct(void)
         BUG_ON( sdom->active_vcpu_count == 0 );
         BUG_ON( sdom->weight == 0 );
         BUG_ON( sdom->weight > weight_left );
+
+        /* Compute the average of active VCPUs. */
+        credit_sum = 0;
+        list_for_each_safe( iter_vcpu, next_vcpu, &sdom->active_vcpu )
+        {
+            svc = list_entry(iter_vcpu, struct csched_vcpu, active_vcpu_elem);
+            BUG_ON( sdom != svc->sdom );
+
+            credit_sum += atomic_read(&svc->credit);
+        }
+        credit_average = ( credit_sum + (sdom->active_vcpu_count - 1)
+                         ) / sdom->active_vcpu_count;
 
         weight_left -= sdom->weight;
 
@@ -959,8 +972,9 @@ csched_acct(void)
             svc = list_entry(iter_vcpu, struct csched_vcpu, active_vcpu_elem);
             BUG_ON( sdom != svc->sdom );
 
-            /* Increment credit */
-            atomic_add(credit_fair, &svc->credit);
+            /* Balance and increment credit */
+            credit = atomic_read(&svc->credit);
+            atomic_add(credit_average - credit + credit_fair, &svc->credit);
             credit = atomic_read(&svc->credit);
 
             /*

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  parent reply	other threads:[~2008-12-18  3:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-18  2:57 [RFC][PATCH 0/4] Modification of credit scheduler rev2 NISHIGUCHI Naoki
2008-12-18  3:00 ` [RFC][PATCH 1/4] sched: more accurate credit scheduling NISHIGUCHI Naoki
2008-12-18  3:02 ` [RFC][PATCH 2/4] sched: change the handling of credits over upper bound NISHIGUCHI Naoki
2008-12-18  3:04 ` NISHIGUCHI Naoki [this message]
2008-12-18  3:06 ` [RFC][PATCH 4/4] sched: introduce boost credit for latency-sensitive domain NISHIGUCHI Naoki
2009-01-13  8:10 ` [RFC][PATCH 0/4] Modification of credit scheduler rev2 Su, Disheng
2009-01-15  2:04   ` NISHIGUCHI Naoki
2009-01-15  2:56     ` Tian, Kevin
2009-01-15  4:42       ` NISHIGUCHI Naoki
2009-01-15  5:04         ` Tian, Kevin
2009-01-15  6:05           ` NISHIGUCHI Naoki
2009-01-15  6:41             ` Tian, Kevin
2009-01-15  7:01               ` NISHIGUCHI Naoki
2009-01-15  7:04                 ` Tian, Kevin
2009-01-15  4:55     ` Su, Disheng
2009-01-15  5:19       ` NISHIGUCHI Naoki
  -- strict thread matches above, loose matches on Subject: below --
2008-12-05 10:01 [RFC][PATCH 0/4] Modification of credit scheduler NISHIGUCHI Naoki
2008-12-05 10:07 ` [RFC][PATCH 3/4] sched: balance credits of each vcpu of a domain 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=4949BDA8.7000305@jp.fujitsu.com \
    --to=nisiguti@jp.fujitsu.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Pratt@eu.citrix.com \
    --cc=aviv@neocleus.com \
    --cc=disheng.su@intel.com \
    --cc=keir.fraser@eu.citrix.com \
    --cc=sakaia@jp.fujitsu.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.