ia64/xen-unstable
changeset 12216:9a4274724794
[XEN] Fix credit scheduler cap mechanism not to over park VCPUs
We used to park a capped VCPU when it had ran its fair share, even
if the fair share was below its cap. With this change, make sure
we only park once a VCPU has overrun its actual cap.
We could also try to make the capping mechanism more accurate by
parking and unparking at a finer granularity (currently done on
30ms boundaries) but that'll be for a different time.
Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>
We used to park a capped VCPU when it had ran its fair share, even
if the fair share was below its cap. With this change, make sure
we only park once a VCPU has overrun its actual cap.
We could also try to make the capping mechanism more accurate by
parking and unparking at a finer granularity (currently done on
30ms boundaries) but that'll be for a different time.
Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>
author | Emmanuel Ackaouy <ack@xensource.com> |
---|---|
date | Wed Nov 01 19:44:34 2006 +0000 (2006-11-01) |
parents | 46fad06ab0b3 |
children | 70687bcb82dd |
files | xen/common/sched_credit.c |
line diff
1.1 --- a/xen/common/sched_credit.c Wed Nov 01 18:48:57 2006 +0000 1.2 +++ b/xen/common/sched_credit.c Wed Nov 01 19:44:34 2006 +0000 1.3 @@ -721,6 +721,7 @@ csched_acct(void) 1.4 uint32_t weight_left; 1.5 uint32_t credit_fair; 1.6 uint32_t credit_peak; 1.7 + uint32_t credit_cap; 1.8 int credit_balance; 1.9 int credit_xtra; 1.10 int credit; 1.11 @@ -751,6 +752,7 @@ csched_acct(void) 1.12 weight_left = weight_total; 1.13 credit_balance = 0; 1.14 credit_xtra = 0; 1.15 + credit_cap = 0U; 1.16 1.17 list_for_each_safe( iter_sdom, next_sdom, &csched_priv.active_sdom ) 1.18 { 1.19 @@ -778,13 +780,15 @@ csched_acct(void) 1.20 (weight_total - 1) 1.21 ) / weight_total; 1.22 } 1.23 + 1.24 if ( sdom->cap != 0U ) 1.25 { 1.26 - uint32_t credit_cap; 1.27 - 1.28 credit_cap = ((sdom->cap * CSCHED_CREDITS_PER_ACCT) + 99) / 100; 1.29 if ( credit_cap < credit_peak ) 1.30 credit_peak = credit_cap; 1.31 + 1.32 + credit_cap = ( credit_cap + ( sdom->active_vcpu_count - 1 ) 1.33 + ) / sdom->active_vcpu_count; 1.34 } 1.35 1.36 credit_fair = ( ( credit_total * sdom->weight) + (weight_total - 1) 1.37 @@ -840,10 +844,10 @@ csched_acct(void) 1.38 */ 1.39 if ( credit < 0 ) 1.40 { 1.41 - if ( sdom->cap == 0U ) 1.42 + if ( sdom->cap != 0U && credit < -credit_cap ) 1.43 + svc->pri = CSCHED_PRI_TS_PARKED; 1.44 + else 1.45 svc->pri = CSCHED_PRI_TS_OVER; 1.46 - else 1.47 - svc->pri = CSCHED_PRI_TS_PARKED; 1.48 1.49 if ( credit < -CSCHED_CREDITS_PER_TSLICE ) 1.50 {