博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
cgroup cpu group 源码分析
阅读量:4192 次
发布时间:2019-05-26

本文共 2302 字,大约阅读时间需要 7 分钟。

cpu group pick_next函数

以下代码来自 pick_next_task_fair

6739         /* 6740          * Because of the set_next_buddy() in dequeue_task_fair() it is rather 6741          * likely that a next task is from the same cgroup as the current. 6742          * 6743          * Therefore attempt to avoid putting and setting the entire cgroup 6744          * hierarchy, only change the part that actually changes. 6745          */ 6746 6747         do { 6748                 struct sched_entity *curr = cfs_rq->curr; 6749 6750                 /* 6751                  * Since we got here without doing put_prev_entity() we also 6752                  * have to consider cfs_rq->curr. If it is still a runnable 6753                  * entity, update_curr() will update its vruntime, otherwise 6754                  * forget we've ever seen it. 6755                  */ 6756                 if (curr) { 6757                         if (curr->on_rq) 6758                                 update_curr(cfs_rq); 6759                         else 6760                                 curr = NULL; 6761 6762                         /* 6763                          * This call to check_cfs_rq_runtime() will do the 6764                          * throttle and dequeue its entity in the parent(s). 6765                          * Therefore the nr_running test will indeed 6766                          * be correct. 6767                          */ 6768                         if (unlikely(check_cfs_rq_runtime(cfs_rq))) { 6769                                 cfs_rq = &rq->cfs; 6770 6771                                 if (!cfs_rq->nr_running) 6772                                         goto idle; 6773 6774                                 goto simple; 6775                         } 6776                 } 6777 6778                 **se = pick_next_entity(cfs_rq, curr);** 6779                 **cfs_rq = group_cfs_rq(se);** 6780         } while (cfs_rq);
279 /* runqueue "owned" by this group */  280 static inline struct cfs_rq *group_cfs_rq(struct sched_entity *grp)  281 {  282         return grp->my_q;  283 }

1) 如果cpu 原始rq pick_next_entity选择的是非cgoup节点, 那么6779行返回空,即 my_q为空

2) 如果6778行选择的cgroup的根节点的sched_entity,那么会根据cgroup层次结构遍历一次遍历, 到最后的一层节点选出的sched_entity的my_q为空,则为真正的task entity

group share 计算

4.19 calc_group_shares

转载地址:http://zploi.baihongyu.com/

你可能感兴趣的文章
网易云推出“音街”APP 入局免费K歌市场
查看>>
首批马云援欧口罩运抵比利时eWTP枢纽
查看>>
微信小程序上线订单管理功能:实现订单管理、售后维权一体化
查看>>
被哥哥巨额索赔56亿?贾跃亭回应:40多亿为联合担保
查看>>
苹果公布App审查新机制 禁止发布疫情相关娱乐程序和游戏
查看>>
市民举报邻居去韩国代购归来未隔离,真相很尴尬:表面防疫,实则打假?
查看>>
首批国产特斯拉车主,被“割了韭菜”
查看>>
中消协发布疫情期间消费维权热点:口罩类投诉最多
查看>>
猛料一顿狂堆!华为P40 Pro详细参数被曝光
查看>>
台积电:如果不能向华为销售芯片,其他订单可快速取代华为空缺
查看>>
张朝阳直播带货首秀 带的不仅是好物而是价值平台
查看>>
修手机时创意被剽窃,男子向苹果索赔7万亿!是认真的吗?
查看>>
拼多多:不搞套路,要实现同品全网最低价直售
查看>>
京东股价创新高:市值首次突破千亿美元 !
查看>>
iPhone 12 Pro系列变贵的原因在这儿!
查看>>
刘慈欣、Netflix联手!《三体》系列将拍摄剧集,但编剧被网友疯狂吐槽
查看>>
2198元买真全面屏手机!网友:笑而不语...
查看>>
官宣!《花木兰》内地定档
查看>>
钱准备好!苹果官方账号泄密:iPhone 12明晚发布有戏
查看>>
LG电子发布旋转双屏5G手机Wing 售价约6800元
查看>>