gdunlap/sched-sim.hg

changeset 12:f34462422a94

c02: Add time-for-equal-credit
author George Dunlap <gdunlap@xensource.com>
date Tue Oct 20 18:15:55 2009 +0100 (2009-10-20)
parents 31f36108fc43
children f378dbd3c2af
files sched_credit02.c
line diff
     1.1 --- a/sched_credit02.c	Tue Oct 20 18:14:37 2009 +0100
     1.2 +++ b/sched_credit02.c	Tue Oct 20 18:15:55 2009 +0100
     1.3 @@ -12,7 +12,7 @@
     1.4  #define CREDIT_INIT  500
     1.5  #define CREDIT_RESET 0
     1.6  #define MAX_TIMER 200
     1.7 -#define MIN_TIMER 100
     1.8 +#define MIN_TIMER 50
     1.9  
    1.10  struct sched_vm {
    1.11      struct list_head runq_elem;
    1.12 @@ -72,18 +72,17 @@ static int calc_timer(struct sched_vm *s
    1.13  
    1.14      if ( time > svm->credit )
    1.15          time = svm->credit;
    1.16 -#if 0
    1.17 +
    1.18      if ( !list_empty(&sched_priv.runq) )
    1.19      {
    1.20          struct sched_vm *sq = list_entry(sched_priv.runq.next, struct sched_vm, runq_elem);
    1.21  
    1.22          ASSERT(svm->credit >= sq->credit);
    1.23  
    1.24 -        if ( (svm->credit - sq->credit) < time )
    1.25 +        if ( time > (svm->credit - sq->credit) )
    1.26              time = (svm->credit - sq->credit);
    1.27      }
    1.28  
    1.29 -#endif
    1.30  
    1.31      if ( time < MIN_TIMER )
    1.32          time = MIN_TIMER;
    1.33 @@ -266,7 +265,7 @@ static struct vm* sched_credit_schedule(
    1.34  struct scheduler sched_credit02 =
    1.35  {
    1.36      .name="credit02",
    1.37 -    .desc="Zero-start, burn based on weight, reset to zero at negative credit",
    1.38 +    .desc="Zero-start, burn based on weight, reset to zero at negative credit, with time-on-credit-equal",
    1.39      .ops = {
    1.40          .sched_init = sched_credit_init,
    1.41          .vm_init    = sched_credit_vm_init,