ChangeSet 1.1159.170.108, 2005/04/01 00:09:27+01:00, sd386@xxxxxxxxxxxxxxxxx
mainly layout changes, but also minor bugfixes along my way
sched_sedf.c | 851 +++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 541 insertions(+), 310 deletions(-)
diff -Nru a/xen/common/sched_sedf.c b/xen/common/sched_sedf.c
--- a/xen/common/sched_sedf.c 2005-05-09 14:05:27 -04:00
+++ b/xen/common/sched_sedf.c 2005-05-09 14:05:27 -04:00
@@ -13,9 +13,9 @@
#include <xen/time.h>
#include <xen/slab.h>
-//#include <xen/adv_sched_hist.h>
+/*#include <xen/adv_sched_hist.h>*/
-//verbosity settings
+/*verbosity settings*/
#define SEDFLEVEL 0
#define PRINT(_f, _a...) \
if ((_f)<=SEDFLEVEL) printk(_a );
@@ -24,7 +24,7 @@
#define SEDF_STATS
#endif
-//various ways of unblocking domains
+/*various ways of unblocking domains*/
#define UNBLOCK_ISOCHRONOUS_EDF 1
#define UNBLOCK_EDF 2
#define UNBLOCK_ATROPOS 3
@@ -33,7 +33,7 @@
#define UNBLOCK_EXTRA_SUPPORT 6
#define UNBLOCK UNBLOCK_EXTRA_SUPPORT
-//various ways of treating extra-time
+/*various ways of treating extra-time*/
#define EXTRA_OFF 1
#define EXTRA_ROUNDR 2
#define EXTRA_SLICE_WEIGHT 3
@@ -63,29 +63,35 @@
struct list_head list;
struct list_head extralist[2];
- //Parameters for EDF
- s_time_t period; //=(relative deadline)
- s_time_t slice; //=worst case execution time
+ /*Parameters for EDF*/
+ s_time_t period; /*=(relative deadline)*/
+ s_time_t slice; /*=worst case execution time*/
- //Advaced Parameters
- //Latency Scaling
+ /*Advaced Parameters*/
+ /*Latency Scaling*/
s_time_t period_orig;
s_time_t slice_orig;
s_time_t latency;
- short extra; //extra-time status of domain
- short weight; //weights for "Scheduling for
beginners/ lazy/ etc." ;)
+ /*extra-time status of domain*/
+ short extra;
+ /*weights for "Scheduling for beginners/ lazy/ etc." ;)*/
+ short weight;
- //Bookkeeping
+ /*Bookkeeping*/
s_time_t absdead;
s_time_t sched_start;
s_time_t cputime;
- s_time_t absblock;
- s_time_t absunblock; //time the domain unblocked,
used by burst mode to determine unblocking intervals
- int score[2]; //scores for {util, block
penalty}-weighted extratime distribution
+ s_time_t absblock;
+
+ /*time the domain unblocked, used to determine unblocking intervals*/
+ s_time_t absunblock;
+
+ /*scores for {util, block penalty}-weighted extratime distribution*/
+ int score[2];
s_time_t short_block_lost_tot;
- //Statistics
+ /*Statistics*/
s_time_t extra_time_tot;
#ifdef SEDF_STATS
@@ -107,7 +113,7 @@
};
#define DOM_INFO(d) ((struct sedf_dom_info *)((d)->sched_priv))
-#define CPU_INFO(cpu) ((struct sedf_cpu_info
*)schedule_data[cpu].sched_priv)
+#define CPU_INFO(cpu) ((struct sedf_cpu_info *)schedule_data[cpu].sched_priv)
#define LIST(d) (&DOM_INFO(d)->list)
#define EXTRALIST(d,i) (&(DOM_INFO(d)->extralist[i]))
#define RUNQ(cpu) (&CPU_INFO(cpu)->runnableq)
@@ -125,7 +131,8 @@
static void sedf_dump_cpu_state(int i);
static inline int extraq_on(struct domain *d, int i) {
- return ((EXTRALIST(d,i)->next != NULL) && (EXTRALIST(d,i)->next !=
EXTRALIST(d,i)));
+ return ((EXTRALIST(d,i)->next != NULL) &&
+ (EXTRALIST(d,i)->next != EXTRALIST(d,i)));
}
static inline void extraq_add_head(struct domain *d, int i)
@@ -142,7 +149,8 @@
{
struct list_head *list = EXTRALIST(d,i);
/*if (!extraq_on(d,i)) {
- PRINT(0,"extraq_del: domain %i is NOT on L%i extraq!
HALTING\n",d->id,i);
+ PRINT(0,"extraq_del: domain %i is NOT on L%i extraq "\
+ "HALTING\n",d->id,i);
sedf_dump_cpu_state(0);(*((int*)0))++;
}*/
PRINT(3, "Removing domain %i from L%i extraq\n", d->id,i);
@@ -150,55 +158,67 @@
list->next = NULL;
}
-/* adds a domain to the queue of processes which are aware of extra time. List
is sorted by score,
- where a lower score means higher priority for an extra slice. It also
updates the score, by simply subtracting
- a fixed value from each entry, in order to avoid overflow. The algorithm
works by simply charging each domain
- that recieved extratime with an inverse of its weight.
+/* adds a domain to the queue of processes which are aware of extra time. List
+ is sorted by score, where a lower score means higher priority for an extra
+ slice. It also updates the score, by simply subtracting a fixed value from
+ each entry, in order to avoid overflow. The algorithm works by simply
+ charging each domain that recieved extratime with an inverse of its weight.
*/
static inline void extraq_add_sort_update(struct domain *d, int i, int sub) {
struct list_head *cur;
struct sedf_dom_info *curinf;
/*if (extraq_on(d,i)) {
- PRINT(0,"extraq_add_sort_update: domain %i is already on L%i
extraq! HALTING\n",d->id,i);
+ PRINT(0,"extraq_add_sort_update: domain %i is already on "\
+ "L%i extraq! HALTING\n",d->id,i);
sedf_dump_cpu_state(0);(*((int*)0))++;
}*/
- PRINT(3, "Adding domain %i (score= %i, short_pen= %lli) to L%i
extraq\n", d->id,
- DOM_INFO(d)->score[i], DOM_INFO(d)->short_block_lost_tot, i);
- //iterate through all elements to find our "hole" and on our way update
all the other scores
+ PRINT(3, "Adding domain %i (score= %i, short_pen= %lli) to L%i "\
+ "extraq\n", d->id, DOM_INFO(d)->score[i],
+ DOM_INFO(d)->short_block_lost_tot, i);
+ /*iterate through all elements to find our "hole" and on our way
+ update all the other scores*/
list_for_each(cur,EXTRAQ(d->processor,i)){
- curinf = list_entry(cur,struct
sedf_dom_info,extralist[i]);
+ curinf = list_entry(cur,struct sedf_dom_info,extralist[i]);
curinf->score[i] -= sub;
if (DOM_INFO(d)->score[i] < curinf->score[i])
break;
else
- PRINT(4,"\tbehind domain %i (score= %i)\n",
curinf->owner->id, curinf->score[i]);
+ PRINT(4,"\tbehind domain %i (score= %i)\n",
+ curinf->owner->id, curinf->score[i]);
}
- //cur now contains the element, before which we'll enq ueue
+ /*cur now contains the element, before which we'll enqueue*/
PRINT(3, "\tlist_add to %x\n", cur->prev);
list_add(EXTRALIST(d,i),cur->prev);
- //continue updating the extraq
- if ((cur != EXTRAQ(d->processor,i)) && sub)
- for (cur = cur->next; cur != EXTRAQ(d->processor,i); cur =
cur-> next) {
- curinf = list_entry(cur,struct
sedf_dom_info,extralist[i]);
+ /*continue updating the extraq*/
+ if ((cur != EXTRAQ(d->processor,i)) && sub)
+ for (cur = cur->next; cur != EXTRAQ(d->processor,i);
+ cur = cur-> next) {
+ curinf = list_entry(cur,struct sedf_dom_info,
+ extralist[i]);
curinf->score[i] -= sub;
- PRINT(4, "\tupdating domain %i (score= %llu)\n",
curinf->owner->id, curinf->score[i]);
+ PRINT(4, "\tupdating domain %i (score= %llu)\n",
+ curinf->owner->id, curinf->score[i]);
}
}
static inline void extraq_check(struct domain *d) {
if (extraq_on(d, EXTRA_UTIL_Q)) {
PRINT(2,"Dom %i is on extraQ\n",d->id);
- if (!(DOM_INFO(d)->extra & EXTRA_AWARE) &&
!extra_runs(DOM_INFO(d))) {
+ if (!(DOM_INFO(d)->extra & EXTRA_AWARE) &&
+ !extra_runs(DOM_INFO(d))) {
extraq_del(d, EXTRA_UTIL_Q);
PRINT(2,"Removed dom %i from L1 extraQ\n",d->id);
}
} else {
PRINT(2,"Dom %i is NOT on L1 extraQ\n",d->id);
- if ((DOM_INFO(d)->extra & EXTRA_AWARE) && domain_runnable(d)) {
+ if ((DOM_INFO(d)->extra & EXTRA_AWARE) && domain_runnable(d))
+ {
#if (EXTRA == EXTRA_ROUNDR)
- extraq_add_tail(d, EXTRA_UTIL_Q);
//Favour domains which got short unblocked
- #elif (EXTRA == EXTRA_SLICE_WEIGHT || EXTRA ==
EXTRA_BLOCK_WEIGHT)
+ /*Favour domains which got short unblocked*/
+ extraq_add_tail(d, EXTRA_UTIL_Q);
+ #elif (EXTRA == EXTRA_SLICE_WEIGHT || \
+ EXTRA == EXTRA_BLOCK_WEIGHT)
extraq_add_sort_update(d, EXTRA_UTIL_Q, 0);
#elif
;
@@ -210,52 +230,61 @@
static inline void __del_from_queue(struct domain *d)
{
struct list_head *list = LIST(d);
- PRINT(3,"Removing domain %i (bop= %llu) from
runq/waitq\n",d->id,PERIOD_BEGIN(DOM_INFO(d)));
+ PRINT(3,"Removing domain %i (bop= %llu) from runq/waitq\n", d->id,
+ PERIOD_BEGIN(DOM_INFO(d)));
list_del(list);
list->next = NULL;
}
-/* adds a domain to the queue of processes which wait for the beginning of the
next period
- * this list is therefore sortet by this time, which is simply absol. deadline
- period
+/* adds a domain to the queue of processes which wait for the beginning of the
+ next period; this list is therefore sortet by this time, which is simply
+ absol. deadline - period
*/
static inline void __add_to_waitqueue_sort(struct domain *d) {
struct list_head *cur;
struct sedf_dom_info *curinf;
- PRINT(3,"Adding domain %i (bop= %llu) to
waitq\n",d->id,PERIOD_BEGIN(DOM_INFO(d)));
- //iterate through all elements to find our "hole"
+ PRINT(3,"Adding domain %i (bop= %llu) to waitq\n", d->id,
+ PERIOD_BEGIN(DOM_INFO(d)));
+
+ /*iterate through all elements to find our "hole"*/
list_for_each(cur,WAITQ(d->processor)){
curinf = list_entry(cur,struct sedf_dom_info,list);
if (PERIOD_BEGIN(DOM_INFO(d)) < PERIOD_BEGIN(curinf))
break;
else
- PRINT(4,"\tbehind domain %i (bop=
%llu)\n",curinf->owner->id,PERIOD_BEGIN(curinf));
+ PRINT(4,"\tbehind domain %i (bop= %llu)\n",
+ curinf->owner->id, PERIOD_BEGIN(curinf));
}
- //cur now contains the element, before which we'll enqueue
+ /*cur now contains the element, before which we'll enqueue*/
PRINT(3,"\tlist_add to %x\n",cur->prev);
list_add(LIST(d),cur->prev);
}
-/* adds a domain to the queue of processes which have started their current
period and are
- * runnable (i.e. not blocked, dieing,...). The first element on this list is
running on the processor,
- * if the list is empty the idle task will run. As we are implementing EDF,
this list is sorted by
- * deadlines.
+/* adds a domain to the queue of processes which have started their current
+ period and are runnable (i.e. not blocked, dieing,...). The first element
+ on this list is running on the processor, if the list is empty the idle
+ task will run. As we are implementing EDF, this list is sorted by deadlines.
*/
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|