WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Xen

xen-devel

[Top] [All Lists]

[Xen-devel] [RFC][PATCH 1/4] sched: more accurate credit scheduling

To: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [RFC][PATCH 1/4] sched: more accurate credit scheduling
From: NISHIGUCHI Naoki <nisiguti@xxxxxxxxxxxxxx>
Date: 2008年12月18日 12:00:54 +0900
Cc: Ian.Pratt@xxxxxxxxxxxxx, disheng.su@xxxxxxxxx, aviv@xxxxxxxxxxxx, keir.fraser@xxxxxxxxxxxxx, sakaia@xxxxxxxxxxxxxx
Delivery-date: 2008年12月17日 19:01:27 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4949BC2C.4060302@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4949BC2C.4060302@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.18 (Windows/20081105)
By applying this patch, the credit scheduler subtracts accurately credit consumed and sets correctly priority. CSCHED_CREDITS_PER_TICK is changed from 100 to 10000, because vcpu's credit is subtracted in csched_schedule(). The difference between this patch and last patch is that start_time variable was moved from csched_vcpu structure to csched_pcpu structure.
Best regards,
Naoki Nishiguchi
diff -r 6595393a3d28 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c Tue Dec 09 16:28:02 2008 +0000
+++ b/xen/common/sched_credit.c Tue Dec 16 19:15:18 2008 +0900
@@ -42,7 +42,7 @@
 #define CSCHED_MSECS_PER_TICK 10
 #define CSCHED_MSECS_PER_TSLICE \
 (CSCHED_MSECS_PER_TICK * CSCHED_TICKS_PER_TSLICE)
-#define CSCHED_CREDITS_PER_TICK 100
+#define CSCHED_CREDITS_PER_TICK 10000
 #define CSCHED_CREDITS_PER_TSLICE \
 (CSCHED_CREDITS_PER_TICK * CSCHED_TICKS_PER_TSLICE)
 #define CSCHED_CREDITS_PER_ACCT \
@@ -188,6 +188,7 @@ struct csched_pcpu {
 uint32_t runq_sort_last;
 struct timer ticker;
 unsigned int tick;
+ s_time_t start_time;
 };
 
 /*
@@ -545,11 +546,6 @@ csched_vcpu_acct(unsigned int cpu)
 svc->pri = CSCHED_PRI_TS_UNDER;
 
 /*
- * Update credits
- */
- atomic_sub(CSCHED_CREDITS_PER_TICK, &svc->credit);
-
- /*
 * Put this VCPU and domain back on the active list if it was
 * idling.
 *
@@ -1168,12 +1164,27 @@ csched_schedule(s_time_t now)
 {
 const int cpu = smp_processor_id();
 struct list_head * const runq = RUNQ(cpu);
+ struct csched_pcpu * const spc = CSCHED_PCPU(cpu);
 struct csched_vcpu * const scurr = CSCHED_VCPU(current);
 struct csched_vcpu *snext;
 struct task_slice ret;
+ s_time_t passed = now - spc->start_time;
+ int consumed;
 
 CSCHED_STAT_CRANK(schedule);
 CSCHED_VCPU_CHECK(current);
+
+ /*
+ * Update credit
+ */
+ consumed = ( passed +
+ (MILLISECS(CSCHED_MSECS_PER_TSLICE) /
+ CSCHED_CREDITS_PER_TSLICE - 1)
+ ) /
+ ( MILLISECS(CSCHED_MSECS_PER_TSLICE) /
+ CSCHED_CREDITS_PER_TSLICE );
+ if ( consumed > 0 && !is_idle_vcpu(current) )
+ atomic_sub(consumed, &scurr->credit);
 
 /*
 * Select next runnable local VCPU (ie top of local runq)
@@ -1217,6 +1228,8 @@ csched_schedule(s_time_t now)
 */
 ret.time = MILLISECS(CSCHED_MSECS_PER_TSLICE);
 ret.task = snext->vcpu;
+
+ spc->start_time = now;
 
 CSCHED_VCPU_CHECK(ret.task);
 return ret;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
Previous by Date: [Xen-devel] [RFC][PATCH 0/4] Modification of credit scheduler rev2 , NISHIGUCHI Naoki
Next by Date: [Xen-devel] [RFC][PATCH 2/4] sched: change the handling of credits over upper bound , NISHIGUCHI Naoki
Previous by Thread: [Xen-devel] [RFC][PATCH 0/4] Modification of credit scheduler rev2 , NISHIGUCHI Naoki
Next by Thread: [Xen-devel] [RFC][PATCH 2/4] sched: change the handling of credits over upper bound , NISHIGUCHI Naoki
Indexes: [Date] [Thread] [Top] [All Lists]

Copyright ©, Citrix Systems Inc. All rights reserved. Legal and Privacy
Citrix This site is hosted by Citrix

AltStyle によって変換されたページ (->オリジナル) /