Hi all, Now I am reading the source code sched-credit. The xen version is 4.2.1. I can not fully understand two places. One place is: There is a variable in schedule.c. There is per cpu variable, tasklet_work_to_do. Read this variable, set the tasklet_work, unsigned long *tasklet_work = &this_cpu(tasklet_work_to_do); bool_t tasklet_work_scheduled = 0; Then according to the task_work, set the tasklet_work_scheduled: /* Update tasklet scheduling status. */ switch ( *tasklet_work ) { case TASKLET_enqueued: set_bit(_TASKLET_scheduled, tasklet_work); case TASKLET_enqueued|TASKLET_scheduled: tasklet_work_scheduled = 1; break; case TASKLET_scheduled: clear_bit(_TASKLET_scheduled, tasklet_work); case 0: /*tasklet_work_scheduled = 0;*/ break; default: BUG(); } I can not understand the function of tasklet_work_to_do, tasklet_work, tasklet_work_scheduled. I can not understand their meaning. In the sched_credit.c file, there are two places that use tasklet_work_scheduled. I can not understand the meaning of tasklet_work_scheduled. One place: if ( !tasklet_work_scheduled && prv->ratelimit_us && vcpu_runnable(current) && !is_idle_vcpu(current) && runtime < MICROSECS(prv->ratelimit_us) ) { snext = scurr; snext->start_time += now; perfc_incr(delay_ms); tslice = MICROSECS(prv->ratelimit_us); ret.migrated = 0; goto out; } the other place: if ( tasklet_work_scheduled ) { snext = CSCHED_VCPU(idle_vcpu[cpu]); snext->pri = CSCHED_PRI_TS_BOOST; } This variable tasklet_work_scheduled is obstacle I understand the source code. Other question is the member s_time_t start_time in structure struct csched_vcpu. The meaning and function for this variable? I do not know why when a vcpu is descheduled, its start_time - now, why a vcpu is scheduled, its start_time + now? deschedule: if ( !is_idle_vcpu(scurr->vcpu) ) { /* Update credits of a non-idle VCPU. */ burn_credits(scurr, now); scurr->start_time -= now; } schedule: if ( !tasklet_work_scheduled && prv->ratelimit_us && vcpu_runnable(current) && !is_idle_vcpu(current) && runtime < MICROSECS(prv->ratelimit_us) ) { snext = scurr; snext->start_time += now; perfc_incr(delay_ms); tslice = MICROSECS(prv->ratelimit_us); ret.migrated = 0; goto out; } Anybody can give me some advice for these problems? Thank you in advance! _______________________________________________ Xen-users mailing list Xen-users@lists.xen.org http://lists.xen.org/xen-users