您的位置:首页 > 其它

Documentation/sched-bwc.txt

2013-09-25 14:37 357 查看
Chinese translated version of Documentation/sched-bwc.txt

If you have any comment or update to the content, please contact the

original document maintainer directly. However, if you have a problem

communicating in English you can also ask the Chinese maintainer for

help. Contact the Chinese maintainer if this translation is outdated

or if there is a problem with the translation.

Chinese maintainer: majg <1519014266@qq.com>

---------------------------------------------------------------------

Documentation/sched-bwc.txt 的中文翻译

如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文

交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻

译存在问题,请联系中文版维护者。

中文版维护者: 马建刚 majg <1519014266@qq.com>

中文版翻译者: 马建刚 majg <1519014266@qq.com>

中文版校译者: 马建刚 majg <1519014266@qq.com>

以下为正文

---------------------------------------------------------------------

-CFS带宽控制

CFS Bandwidth Control

=====================

[ This document only discusses CPU bandwidth control for SCHED_NORMAL.

The SCHED_RT case is covered in Documentation/scheduler/sched-rt-group.txt ]

-本文档只讨论CPU带宽控制SCHED_NORMAL的SCHED_RT案件中文档/调度/SCHED-RT-group.txt的覆盖

CFS bandwidth control is a CONFIG_FAIR_GROUP_SCHED extension which allows the

specification of the maximum CPU bandwidth available to a group or hierarchy.

-CFS的带宽控制是一个CONFIG_FAIR_GROUP_SCHED的的的扩展,它允许的CPU的最大可用带宽的一组或层次的规范。

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.

-带宽允许一组使用指定的配额和周期。在每个给定的“期间”(微秒),

一组最多只允许消耗“配额”微秒的CPU时间。当CPU的带宽消耗组大小超

出该限制(在该段期间),属于其的任务层次结构将被扼杀,且不得再

次运行,直到下一个时期。

A group's unused runtime is globally tracked, being refreshed with quota units

above at each period boundary. As threads consume this bandwidth it is

transferred to cpu-local "silos" on a demand basis. The amount transferred

within each of these updates is tunable and described as the "slice".

-A组的全球跟踪未使用的运行时,配额单位被刷新上述每个周期边界。

当线程消耗带宽转移到CPU本地需求的基础上的“孤岛”。转让金额于每

个这些更新是可调的,并描述为“切片”。

Management

-管理

----------

Quota and period are managed within the cpu subsystem via cgroupfs.

-cgroup的CPU子系统通过配额和周期内进行管理。

cpu.cfs_quota_us: the total available run-time within a period (in microseconds)

-cpu.cfs_quota_us:总的可用运行一段时间内(微秒)

cpu.cfs_period_us: the length of a period (in microseconds)

-cpu.cfs期间的周期长度(微秒)

cpu.stat: exports throttling statistics [explained further below]

-cpu.stat:出口节流统计[下文进一步解释]

The default values are:

cpu.cfs_period_us=100ms

cpu.cfs_quota=-1

-默认值是:

-cpu.cfs_period_us=为100ms

-cpu.xfs_quota=-1

A value of -1 for cpu.cfs_quota_us indicates that the group does not have any

bandwidth restriction in place, such a group is described as an unconstrained

bandwidth group. This represents the traditional work-conserving behavior for

CFS.

-cpu.cfs_quota_us值为-1表示该组没有任何带宽限制的地方,

这样的基团被描述为一个无约束的带宽组。这代表传统保工作行为CFS。

Writing any (valid) positive value(s) will enact the specified bandwidth limit.

The minimum quota allowed for the quota or period is 1ms. There is also an

upper bound on the period length of 1s. Additional restrictions exist when

bandwidth limits are used in a hierarchical fashion, these are explained in

more detail below.

-编写任何(有效)阳性值(s)将制定指定带宽限制。配额或期间所允许的最低额度为1ms。此外,还有一个

上限1周期长度。存在其他限制时,带宽的限制是用于在一个分层的方式,这些都是解释更详细说明。

Writing any negative value to cpu.cfs_quota_us will remove the bandwidth limit

and return the group to an unconstrained state once more.

-写作任何负值cpu.cfs_quota_us的将删除的带宽限制,并返回该组的一次不受约束的状态。

Any updates to a group's bandwidth specification will result in it becoming

unthrottled if it is in a constrained state.

-任何一组的带宽规格在约束状态的更新会导致其成为未经节流的。

System wide settings

-系统范围的设置

--------------------

For efficiency run-time is transferred between the global pool and CPU local

"silos" in a batch fashion. This greatly reduces global accounting pressure

on large systems. The amount transferred each time such an update is required

is described as the "slice".

-为了提高效率,运行时全局池之间传送和CPU局部“孤岛”在批处理时。

这大大降低了设计大型系统的压力。调入量每次需要更新被描述为“切片”。

This is tunable via procfs:

-这是通过procfs的可调:

/proc/sys/kernel/sched_cfs_bandwidth_slice_us (default=5ms)

Larger slice values will reduce transfer overheads, while smaller values allow

for more fine-grained consumption.

-较大的切片值会降低传输费用,而较小的值允许为更细粒度消费。

Statistics

-统计

----------

A group's bandwidth statistics are exported via 3 fields in cpu.stat.

-A组的带宽统计数据导出通过3场cpu.stat。

cpu.stat:

- nr_periods:执行后所经过的时间间隔数。

- nr_periods: Number of enforcement intervals that have elapsed.

- nr_throttled:这个组得次数已节流/限制。

- nr_throttled: Number of times the group has been throttled/limited.

- throttled_time,总持续时间(纳秒)组实体被扼杀。

- throttled_time: The total time duration (in nanoseconds) for which entities

of the group have been throttled.

This interface is read-only.

-这个是只读接口。

Hierarchical considerations

-分层考虑

---------------------------

-The interface enforces that an individual entity's bandwidth is always

attainable, that is: max(c_i) <= C. However, over-subscription in the

aggregate case is explicitly allowed to enable work-conserving semantics

within a hierarchy.

-接口执行个体的带宽是可以实现的,那就是:最大(c_i)<=C。然而,

在总的情况下认购是明确允许的使工作保持语义在层次结构内。

e.g. \Sum (c_i) may exceed C

[ Where C is the parent's bandwidth, and c_i its children ]

[ 其中C是父母的带宽,和c_i儿童 ]

There are two ways in which a group may become throttled:

a. it fully consumes its own quota within a period

b. a parent's quota is fully consumed within its period

-这可能成为节流在一组的方式有两种:

a.它完全消耗了自己的配额在期限内

b.父母的配额被完全消耗在其周期内

In case b) above, even though the child may have runtime remaining it will not

be allowed to until the parent's runtime is refreshed.

-在案例B)以上,即使孩子可能有剩余运行时间也不被允许直到到父的运行刷新结束。

Examples

-示例

--------

1. Limit a group to 1 CPU worth of runtime.

-限制了一批价值1个CPU的运行时间。

If period is 250ms and quota is also 250ms, the group will get

1 CPU worth of runtime every 250ms.

-如果周期是250毫秒和配额也是250ms的,本组将获得1个CPU运行时每250毫秒。

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

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

2. Limit a group to 2 CPUs worth of runtime on a multi-CPU machine.

-限制一组2个处理器在多CPU的机器上运行时间。

With 500ms period and 1000ms quota, the group can get 2 CPUs worth of

runtime every 500ms.

-500ms的期间1000MS配额的,可以得到价值2个CPU运行时每500ms。

# echo 1000000 > cpu.cfs_quota_us /* quota = 1000ms */

# echo 500000 > cpu.cfs_period_us /* period = 500ms */

The larger period here allows for increased burst capacity.

-较大的时间在这里可以增加应对突发状况的能力。

3. Limit a group to 20% of 1 CPU.

-一组限制到20%,1个CPU。

With 50ms period, 10ms quota will be equivalent to 20% of 1 CPU.

-10ms的配额与50ms的时期,将相当于1个CPU的20%。

# echo 10000 > cpu.cfs_quota_us /* quota = 10ms */

# echo 50000 > cpu.cfs_period_us /* period = 50ms */

By using a small period here we are ensuring a consistent latency

response at the expense of burst capacity.

-在这里使用一个小的时期,我们将确保一致的延迟响应突发能力为代价的。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: