/*
* Get the amount of time the current task was running
* since the last time we changed load (this cannot
* overflow on 32 bits):
*/
delta_exec =(unsignedlong)(now - curr->exec_start); if(!delta_exec) return;
update_curr()calculate execute time of current process and store that value in delta_exec, and it then pass that value to __update_curr(), which weights the time by the number of runnable processes.The current process' vruntime is increment by the weight time.
update_curr() is invoked periodically by system timer and whenever a process become runnable or blocks, becoming unrunnable. In this manner, vruntime is an accurate measure of the run time of a given process and an indicator of what process should be run next.
/*
* Update the current task's runtime statistics. Skip current tasks that
* are not in our scheduling class.
*/ staticinlinevoid
__update_curr(struct cfs_rq *cfs_rq,struct sched_entity *curr, unsignedlong delta_exec) { unsignedlong delta_exec_weighted;