Add context_saved scheduler callback. Because credit2 shares a runqueue between several cpus, it needs to know when a scheduled-out process has finally been context-switched away so that it can be added to the runqueue again. (Otherwise it may be grabbed by another processor before the context has been properly saved.) Signed-off-by: George Dunlap diff -r c44b7b9b6306 xen/common/schedule.c --- a/xen/common/schedule.c Wed Jan 13 13:33:57 2010 +0000 +++ b/xen/common/schedule.c Wed Jan 13 13:36:37 2010 +0000 @@ -877,6 +877,8 @@ /* Check for migration request /after/ clearing running flag. */ smp_mb(); + SCHED_OP(context_saved, prev); + if ( unlikely(test_bit(_VPF_migrating, &prev->pause_flags)) ) vcpu_migrate(prev); } diff -r c44b7b9b6306 xen/include/xen/sched-if.h --- a/xen/include/xen/sched-if.h Wed Jan 13 13:33:57 2010 +0000 +++ b/xen/include/xen/sched-if.h Wed Jan 13 13:36:37 2010 +0000 @@ -69,6 +69,7 @@ void (*sleep) (struct vcpu *); void (*wake) (struct vcpu *); + void (*context_saved) (struct vcpu *); struct task_slice (*do_schedule) (s_time_t);