ia64/xen-unstable

changeset 12049:64f0e77f2129

[XEN] Cleanup and optimize layout of credit scheduler stats.
Also carve out per VCPU stats for clarity and add per-VCPU
migration counter.
Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>
author Emmanuel Ackaouy <ack@xensource.com>
date Tue Oct 31 10:10:17 2006 +0000 (2006-10-31)
parents d9a0690399e0
children e0942ef72b8e
files xen/common/sched_credit.c
line diff
     1.1 --- a/xen/common/sched_credit.c	Tue Oct 31 09:49:31 2006 +0000
     1.2 +++ b/xen/common/sched_credit.c	Tue Oct 31 10:10:17 2006 +0000
     1.3 @@ -82,19 +82,12 @@
     1.4          printk("\t%-30s = %u\n", #_X, CSCHED_STAT(_X));  \
     1.5      } while ( 0 );
     1.6  
     1.7 +/*
     1.8 + * Try and keep often cranked stats on top so they'll fit on one
     1.9 + * cache line.
    1.10 + */
    1.11  #define CSCHED_STATS_EXPAND_SCHED(_MACRO)   \
    1.12 -    _MACRO(vcpu_init)                       \
    1.13 -    _MACRO(vcpu_sleep)                      \
    1.14 -    _MACRO(vcpu_wake_running)               \
    1.15 -    _MACRO(vcpu_wake_onrunq)                \
    1.16 -    _MACRO(vcpu_wake_runnable)              \
    1.17 -    _MACRO(vcpu_wake_not_runnable)          \
    1.18 -    _MACRO(dom_destroy)                     \
    1.19      _MACRO(schedule)                        \
    1.20 -    _MACRO(tickle_local_idler)              \
    1.21 -    _MACRO(tickle_local_over)               \
    1.22 -    _MACRO(tickle_local_under)              \
    1.23 -    _MACRO(tickle_local_other)              \
    1.24      _MACRO(acct_run)                        \
    1.25      _MACRO(acct_no_work)                    \
    1.26      _MACRO(acct_balance)                    \
    1.27 @@ -102,20 +95,28 @@
    1.28      _MACRO(acct_min_credit)                 \
    1.29      _MACRO(acct_vcpu_active)                \
    1.30      _MACRO(acct_vcpu_idle)                  \
    1.31 -    _MACRO(acct_vcpu_credit_min)
    1.32 -
    1.33 -#define CSCHED_STATS_EXPAND_SMP_LOAD_BALANCE(_MACRO)    \
    1.34 -    _MACRO(vcpu_migrate)                                \
    1.35 -    _MACRO(load_balance_idle)                           \
    1.36 -    _MACRO(load_balance_over)                           \
    1.37 -    _MACRO(load_balance_other)                          \
    1.38 -    _MACRO(steal_trylock_failed)                        \
    1.39 -    _MACRO(steal_peer_down)                             \
    1.40 -    _MACRO(steal_peer_idle)                             \
    1.41 -    _MACRO(steal_peer_running)                          \
    1.42 -    _MACRO(steal_peer_pinned)                           \
    1.43 -    _MACRO(tickle_idlers_none)                          \
    1.44 -    _MACRO(tickle_idlers_some)
    1.45 +    _MACRO(vcpu_sleep)                      \
    1.46 +    _MACRO(vcpu_wake_running)               \
    1.47 +    _MACRO(vcpu_wake_onrunq)                \
    1.48 +    _MACRO(vcpu_wake_runnable)              \
    1.49 +    _MACRO(vcpu_wake_not_runnable)          \
    1.50 +    _MACRO(tickle_local_idler)              \
    1.51 +    _MACRO(tickle_local_over)               \
    1.52 +    _MACRO(tickle_local_under)              \
    1.53 +    _MACRO(tickle_local_other)              \
    1.54 +    _MACRO(tickle_idlers_none)              \
    1.55 +    _MACRO(tickle_idlers_some)              \
    1.56 +    _MACRO(vcpu_migrate)                    \
    1.57 +    _MACRO(load_balance_idle)               \
    1.58 +    _MACRO(load_balance_over)               \
    1.59 +    _MACRO(load_balance_other)              \
    1.60 +    _MACRO(steal_trylock_failed)            \
    1.61 +    _MACRO(steal_peer_down)                 \
    1.62 +    _MACRO(steal_peer_idle)                 \
    1.63 +    _MACRO(steal_peer_running)              \
    1.64 +    _MACRO(steal_peer_pinned)               \
    1.65 +    _MACRO(vcpu_init)                       \
    1.66 +    _MACRO(dom_destroy)
    1.67  
    1.68  #ifndef NDEBUG
    1.69  #define CSCHED_STATS_EXPAND_CHECKS(_MACRO)  \
    1.70 @@ -124,10 +125,9 @@
    1.71  #define CSCHED_STATS_EXPAND_CHECKS(_MACRO)
    1.72  #endif
    1.73  
    1.74 -#define CSCHED_STATS_EXPAND(_MACRO)                 \
    1.75 -    CSCHED_STATS_EXPAND_SCHED(_MACRO)               \
    1.76 -    CSCHED_STATS_EXPAND_SMP_LOAD_BALANCE(_MACRO)    \
    1.77 -    CSCHED_STATS_EXPAND_CHECKS(_MACRO)
    1.78 +#define CSCHED_STATS_EXPAND(_MACRO)         \
    1.79 +    CSCHED_STATS_EXPAND_CHECKS(_MACRO)      \
    1.80 +    CSCHED_STATS_EXPAND_SCHED(_MACRO)
    1.81  
    1.82  #define CSCHED_STATS_RESET()                                        \
    1.83      do                                                              \
    1.84 @@ -177,11 +177,14 @@ struct csched_vcpu {
    1.85      struct csched_dom *sdom;
    1.86      struct vcpu *vcpu;
    1.87      atomic_t credit;
    1.88 -    int credit_last;
    1.89 -    uint32_t credit_incr;
    1.90 -    uint32_t state_active;
    1.91 -    uint32_t state_idle;
    1.92      int16_t pri;
    1.93 +    struct {
    1.94 +        int credit_last;
    1.95 +        uint32_t credit_incr;
    1.96 +        uint32_t state_active;
    1.97 +        uint32_t state_idle;
    1.98 +        uint32_t migrate;
    1.99 +    } stats;
   1.100  };
   1.101  
   1.102  /*
   1.103 @@ -404,7 +407,7 @@ csched_vcpu_acct(struct csched_vcpu *svc
   1.104          if ( list_empty(&svc->active_vcpu_elem) )
   1.105          {
   1.106              CSCHED_STAT_CRANK(acct_vcpu_active);
   1.107 -            svc->state_active++;
   1.108 +            svc->stats.state_active++;
   1.109  
   1.110              sdom->active_vcpu_count++;
   1.111              list_add(&svc->active_vcpu_elem, &sdom->active_vcpu);
   1.112 @@ -435,7 +438,7 @@ static inline void
   1.113      BUG_ON( list_empty(&svc->active_vcpu_elem) );
   1.114  
   1.115      CSCHED_STAT_CRANK(acct_vcpu_idle);
   1.116 -    svc->state_idle++;
   1.117 +    svc->stats.state_idle++;
   1.118  
   1.119      sdom->active_vcpu_count--;
   1.120      list_del_init(&svc->active_vcpu_elem);
   1.121 @@ -495,11 +498,8 @@ csched_vcpu_init(struct vcpu *vc)
   1.122      svc->sdom = sdom;
   1.123      svc->vcpu = vc;
   1.124      atomic_set(&svc->credit, 0);
   1.125 -    svc->credit_last = 0;
   1.126 -    svc->credit_incr = 0U;
   1.127 -    svc->state_active = 0U;
   1.128 -    svc->state_idle = 0U;
   1.129      svc->pri = pri;
   1.130 +    memset(&svc->stats, 0, sizeof(svc->stats));
   1.131      vc->sched_priv = svc;
   1.132  
   1.133      CSCHED_VCPU_CHECK(vc);
   1.134 @@ -864,8 +864,8 @@ csched_acct(void)
   1.135                  }
   1.136              }
   1.137  
   1.138 -            svc->credit_last = credit;
   1.139 -            svc->credit_incr = credit_fair;
   1.140 +            svc->stats.credit_last = credit;
   1.141 +            svc->stats.credit_incr = credit_fair;
   1.142              credit_balance += credit;
   1.143          }
   1.144      }
   1.145 @@ -1014,6 +1014,7 @@ csched_load_balance(int cpu, struct csch
   1.146          if ( speer )
   1.147          {
   1.148              CSCHED_STAT_CRANK(vcpu_migrate);
   1.149 +            speer->stats.migrate++;
   1.150              return speer;
   1.151          }
   1.152      }
   1.153 @@ -1100,12 +1101,13 @@ csched_dump_vcpu(struct csched_vcpu *svc
   1.154  
   1.155      if ( sdom )
   1.156      {
   1.157 -        printk(" credit=%i (%d+%u) {a=%u i=%u w=%u}",
   1.158 +        printk(" credit=%i (%d+%u) {a/i=%u/%u m=%u w=%u}",
   1.159              atomic_read(&svc->credit),
   1.160 -            svc->credit_last,
   1.161 -            svc->credit_incr,
   1.162 -            svc->state_active,
   1.163 -            svc->state_idle,
   1.164 +            svc->stats.credit_last,
   1.165 +            svc->stats.credit_incr,
   1.166 +            svc->stats.state_active,
   1.167 +            svc->stats.state_idle,
   1.168 +            svc->stats.migrate,
   1.169              sdom->weight);
   1.170      }
   1.171