术语

CFS:Completely Fair Scheduler--完全公平调度。对应的调度策略为:SCHED_NORMAL。

CFS调度下的带宽控制是:通过允许一个特点进程组在某个周期(period)下的CPU配额(quota)控制其带宽。主要有两个参数:
cpu.cfs_period_us:周期(us)

cpu.cfs_quota_us:配额(us)

此上两个配置通过cgroup文件系统配置。

原文

The bandwidth allowed for a group is specified using a quota and period. Within each given "period" (microseconds), a group is allowed to consume only up to "quota" microseconds of CPU time. When the CPU bandwidth consumption of a group exceeds this limit (for that period), the tasks belonging to its hierarchy will be throttled and are not allowed to run again until the next period.

举例

 # echo 250000 > cpu.cfs_quota_us /* quota = 250ms */# echo 250000 > cpu.cfs_period_us /* period = 250ms */

此配置限制group 在250ms周期内CPU配额为250ms,也就是每隔T=250ms获取一个CPU时间;

 # echo 1000000 > cpu.cfs_quota_us /* quota = 1000ms */# echo 500000 > cpu.cfs_period_us /* period = 500ms */

此配置限制group 在500ms周期内CPU配额为1000ms,也就是每隔T=500ms获得2个CPU时间。

若cfs_quota=-1,表示CPU带宽不受限。

带宽控制统计

#cat cpu.stat
nr_periods 0
nr_throttled 0
throttled_time 0

nr_periods:Number of enforcement intervals that have elapsed.-- 表示过去了多少个cpu.cfs_period_us里面配置的时间周期。

nr_throttled: Number of times the group has been throttled/limited. --在上面的时间(nr_periods)内,此group被限制的次数;

throttled_time:The total time duration (in nanoseconds) for which entities of the group have been throttled.---此group内所有被限制的进程总时间。

参考

内核文档:

Documentation/scheduler/sched-bwc.txt

Linux内核-CFS调度下带宽控制(Bandwidth Control)相关推荐

  1. (4)Linux进程调度-组调度及带宽控制

    目录 背景 1. 概述 2. task_group 2.2 task_group权重 3. cfs_bandwidth 3.1 数据结构 3.2 流程分析 3.2.1 初始化流程 3.2.2 用户设置 ...

  2. Linux进程调度 - 组调度及带宽控制 LoyenWang

    背景 Read the fucking source code! --By 鲁迅 A picture is worth a thousand words. --By 高尔基 说明: Kernel版本: ...

  3. 【Linux 内核】调度器 ② ( sched_class 调度类结构体源码 | 源码路径 linux-5.6.18\kernel\sched\sched.h )

    文章目录 一.调度器 二.sched_class 调度类结构体 一.调度器 上一篇博客 [Linux 内核]调度器 ( 调度器概念 | 调度器目的 | 调度器主要工作 | 调度器位置 | 进程优先级 ...

  4. (5)Linux进程调度-CFS调度器

    目录 背景 1. 概述 2. 数据结构 2.1 调度类 2.2 rq/cfs_rq/task_struct/task_group/sched_entity 3. 流程分析 3.1 runtime与vr ...

  5. Linux进程调度 - CFS调度器 LoyenWang

    背景 Read the fucking source code! --By 鲁迅 A picture is worth a thousand words. --By 高尔基 说明: Kernel版本: ...

  6. Linux进程调度-CFS调度器原理分析及实现,懂了

    1. 概述 (1) Completely Fair Scheduler,完全公平调度器,用于Linux系统中普通进程的调度. (2) CFS采用了红黑树算法来管理所有的调度实体 sched_entit ...

  7. linux内核cfs浅析

    linux调度器的一般原理请参阅<linux进程调度浅析>. 之前的调度器 cfs之前的linux调度器一般使用用户设定的静态优先级,加上对于进程交互性的判断来生成动态优先级,再根据动态优 ...

  8. Linux内核TC工具链路带宽设计--无类队列规定

    Linux 内核的 TC(traffic control)工具可以用来对网络带宽做一定的设计和管理,这里将对这一工具的使用做一定的介绍,在正式开始介绍TC 之前,先对一些基本的单位做一个说明.为了避免 ...

  9. Linux内核TC工具链路带宽设计--CBQ队列规定

    1.1 著名的 CBQ 队列规定 除了可以分类之外,CBQ 也是一个整形器.如果想把一个 10Mbps 的连接整形成 1Mbps 的速率,就应该让链路 90%的时间处于闲置状态,必要的话就强制,以保证 ...

  10. 蜗蜗 Linux内核芬妮下,Linux内核的整体架构

    作者:蜗蜗 发布于:2014-2-21 13:23 分类:Linux内核分析 1. 前言 本文是"Linux内核分析"系列文章的第一篇,会以内核的核心功能为出发点,描述Linux内 ...

最新文章

  1. ubuntu 14.10安装zabbix(lnmp环境)
  2. 少儿编程语言python-2019儿童编程语言大全
  3. Worm HDU 2151
  4. 将资源文件中的数据写回磁盘
  5. Codeforces Round #297 (Div. 2)D. Arthur and Walls 搜索bfs
  6. kafka入门:简介、使用场景、设计原理、主要配置及集群搭建--转载
  7. 这件事,阿里爱了10年
  8. TopHQBooks – PDF 搜索引擎 - 小众软件
  9. 16.6 创建测试数据
  10. php面向对象编程详解,PHP面向对象编程
  11. 软件工程小组第三次正式会议
  12. Network UVA - 315(Tarjan+连通性问题:求割点)
  13. react vs 2017_我在React Europe 2017上学到了什么
  14. 趣谈程序员真香定律:源码即设计
  15. 数字化落后,工业就挨打!
  16. FAQ宝典之Rancher Server
  17. C# 与 C 和 C++ 比较
  18. 国外高手又一力作,CAML Builder
  19. atitit.hbnt orm db 新新增更新最佳实践o99
  20. python爬取酷狗音乐top500_Python爬取酷狗音乐TOP500榜单

热门文章

  1. 深入学习java的困惑:3年开发,下一步学习的方向以及要做什么?
  2. 文件不小心删除了怎么恢复呢,怎么恢复误删除的文件
  3. 《中华人民共和国数据安全法》解读(1)
  4. 易基因|Genome Biol:DNA甲基化在玉米籽粒发育表观调控作用的研究新进展
  5. 此windows7副本不是正版、黑屏7601的解决办法
  6. 《人工智能与模式识别》
  7. CentOS下Nginx+fastcgi+python3搭建web.py服务环境
  8. 学习如何读论文的一些磨刀不误砍柴工
  9. Codeforces 918D MADMAX 图上dp 组合游戏
  10. “铭赛科技”科创板IPO:“机器人王国梦”价值几何?