ia64/xen-unstable

changeset 5841:460405b4723b

Fixed extratime scheduling bug, which caused a prioritised dom0 to overtake the whole cpu.
Signed-off by: Stephan.Diestelhorst@{cl.cam.ac.uk, inf.tu-dresden.de}
author sd386@font.cl.cam.ac.uk
date Fri Jul 22 15:32:31 2005 +0000 (2005-07-22)
parents 7627476544b5
children dc7c14e533c2
files xen/common/sched_sedf.c
line diff
     1.1 --- a/xen/common/sched_sedf.c	Fri Jul 22 14:25:10 2005 +0000
     1.2 +++ b/xen/common/sched_sedf.c	Fri Jul 22 15:32:31 2005 +0000
     1.3 @@ -609,15 +609,16 @@ static inline void desched_extra_dom(s_t
     1.4              inf->score[EXTRA_UTIL_Q] = (inf->period << 10) /
     1.5                  inf->slice;
     1.6          else
     1.7 -            /*give a domain w/ exweight = 1 as much as a domain with
     1.8 -              util = 1/128*/
     1.9 +            /*conversion between realtime utilisation and extrawieght:
    1.10 +              full (ie 100%) utilization is equivalent to 128 extraweight*/
    1.11              inf->score[EXTRA_UTIL_Q] = (1<<17) / inf->extraweight;
    1.12      }
    1.13   check_extra_queues:
    1.14      /* Adding a runnable domain to the right queue and removing blocked ones*/
    1.15      if (sedf_runnable(d)) {
    1.16          /*add according to score: weighted round robin*/
    1.17 -        if (inf->status & (EXTRA_AWARE | EXTRA_WANT_PEN_Q))
    1.18 +        if (((inf->status & EXTRA_AWARE) && (i == EXTRA_UTIL_Q)) ||
    1.19 +            ((inf->status & EXTRA_WANT_PEN_Q) && (i == EXTRA_PEN_Q)))
    1.20              extraq_add_sort_update(d, i, oldscore);
    1.21      }
    1.22      else {
    1.23 @@ -627,12 +628,9 @@ static inline void desched_extra_dom(s_t
    1.24          /*make sure that we remove a blocked domain from the other
    1.25            extraq too*/
    1.26          if (i == EXTRA_PEN_Q) {
    1.27 -            if (extraq_on(d, EXTRA_UTIL_Q))
    1.28 -                extraq_del(d, EXTRA_UTIL_Q);
    1.29 -        }
    1.30 -        else {
    1.31 -            if (extraq_on(d, EXTRA_PEN_Q))
    1.32 -                extraq_del(d, EXTRA_PEN_Q);
    1.33 +            if (extraq_on(d, EXTRA_UTIL_Q)) extraq_del(d, EXTRA_UTIL_Q);
    1.34 +        } else {
    1.35 +            if (extraq_on(d, EXTRA_PEN_Q)) extraq_del(d, EXTRA_PEN_Q);
    1.36          }
    1.37  #endif
    1.38      }
    1.39 @@ -668,7 +666,8 @@ static inline struct task_slice sedf_do_
    1.40          if (!list_empty(extraq[EXTRA_UTIL_Q])) {
    1.41              /*use elements from the normal extraqueue*/
    1.42              runinf   = list_entry(extraq[EXTRA_UTIL_Q]->next,
    1.43 -                                  struct sedf_vcpu_info, extralist[EXTRA_UTIL_Q]);
    1.44 +                                  struct sedf_vcpu_info,
    1.45 +                                  extralist[EXTRA_UTIL_Q]);
    1.46              runinf->status |= EXTRA_RUN_UTIL;
    1.47              ret.task = runinf->vcpu;
    1.48              ret.time = EXTRA_QUANTUM;
    1.49 @@ -943,8 +942,7 @@ static inline void unblock_short_extra_s
    1.50                  inf->status |= EXTRA_WANT_PEN_Q;
    1.51     
    1.52              /*(re-)add domain to the penalty extraq*/
    1.53 -            extraq_add_sort_update(inf->vcpu,
    1.54 -                                   EXTRA_PEN_Q, 0);
    1.55 +            extraq_add_sort_update(inf->vcpu, EXTRA_PEN_Q, 0);
    1.56          }
    1.57      }
    1.58      /*give it a fresh slice in the next period!*/
    1.59 @@ -1119,7 +1117,8 @@ void sedf_wake(struct vcpu *d) {
    1.60      s_time_t              now = NOW();
    1.61      struct sedf_vcpu_info* inf = EDOM_INFO(d);
    1.62   
    1.63 -    PRINT(3, "sedf_wake was called, domain-id %i.%i\n",d->domain->domain_id, d->vcpu_id);
    1.64 +    PRINT(3, "sedf_wake was called, domain-id %i.%i\n",d->domain->domain_id,
    1.65 +          d->vcpu_id);
    1.66   
    1.67      if (unlikely(is_idle_task(d->domain)))
    1.68          return;
    1.69 @@ -1145,7 +1144,7 @@ void sedf_wake(struct vcpu *d) {
    1.70      inf->block_tot++;
    1.71  #endif
    1.72      if (unlikely(now < PERIOD_BEGIN(inf))) {
    1.73 -        PRINT(4,"extratime unblock\n");
    1.74 +    	PRINT(4,"extratime unblock\n");
    1.75          /* unblocking in extra-time! */
    1.76  #if (EXTRA == EXTRA_BLOCK_WEIGHT)
    1.77          if (inf->status & EXTRA_WANT_PEN_Q) {