函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:kernel\sched\fair.c Create Date:2022-07-27 10:38:47
首页 Copyright©Brick

827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
#endif /* CONFIG_SMP */
 
/*
 * Update the current task's runtime statistics.
 */
static void update_curr(struct cfs_rq *cfs_rq)
{
    struct sched_entity *curr = cfs_rq->curr;
    u64 now = rq_clock_task(rq_of(cfs_rq));
    u64 delta_exec;
 
    if (unlikely(!curr))
        return;
 
    delta_exec = now - curr->exec_start;
    if (unlikely((s64)delta_exec <= 0))
        return;
 
    curr->exec_start = now;
 
    schedstat_set(curr->statistics.exec_max,
              max(delta_exec, curr->statistics.exec_max));
 
    curr->sum_exec_runtime += delta_exec;
    schedstat_add(cfs_rq->exec_clock, delta_exec);
 
    curr->vruntime += calc_delta_fair(delta_exec, curr);
    update_min_vruntime(cfs_rq);
 
    if (entity_is_task(curr)) {
        struct task_struct *curtask = task_of(curr);
 
        trace_sched_stat_runtime(curtask, delta_exec, curr->vruntime);
        cgroup_account_cputime(curtask, delta_exec);
        account_group_exec_runtime(curtask, delta_exec);
    }
 
    account_cfs_rq_runtime(cfs_rq, delta_exec);
}