cgroup子系统cpu

rt_runtime_us参数
配置到struct rt_schedulable_data结构的rt_runtime成员
rt_runtime成员引用的地方如下:
1. __sched_setscheduler,在设置sched的配置过程中,如果rt_policy开启,则对进程的task_group属性进行判断,如果其rt_bandwidth.rt_runtime为0,则设置失败,不能将实时进程放入rt_runtime为0的task_group中

    #ifdef CONFIG_RT_GROUP_SCHED
        /*
         * Do not allow realtime tasks into groups that have no runtime
         * assigned.
         */
        if (rt_bandwidth_enabled() && rt_policy(policy) &&
                task_group(p)->rt_bandwidth.rt_runtime == 0 &&
                !task_group_is_autogroup(task_group(p))) {
            task_rq_unlock(rq, p, &flags);
            return -EPERM;
        }
    #endif

2. sched_init,在初始化调度过程中设置rt_runtime成员,初始化发生在start_kernel中,在mm_init之后
    rq->rt.rt_runtime = def_rt_bandwidth.rt_runtime;

3. cpu_rt_runtime_write,实际上为proc文件rt_runtime_us对应的写函数,依次调用sched_group_set_rt_runtime和tg_set_rt_bandwidth进行task_group的rt_bandwidth.rt_runtime属性设置,此处还调用了__rt_schedulable进行判断,来确定是否可以进行设定。判断过程为从root_task_group开始进行遍历循环,判断所有的task_group与其子task_group层级之间的rt_bandwidth信息是否合理,因现有存在的情况已经是合理的,只需要在循环过程中将task_group为当前task_group时对应的rt_bandwidth参数信息替换为准备设置的参数即可完成验证,如果没问题,则进行设置
用到了walk_tg_tree,在其中循环遍历所有group,完成tg_rt_schedulable的检查

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章