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的檢查

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