附录
全局统计
贡献者排名
截至 Linux v6.18+,所有 throttle/bandwidth 相关 commit 的贡献者排名(不完全统计):
| 排名 | 贡献者 | 相关 Commit 数 | 主要贡献 |
|---|---|---|---|
| 1 | Peter Zijlstra | ~20 | throttle_count 同步重构、EEVDF 集成、锁定修复 |
| 2 | Vincent Guittot | ~14 | PELT 修复、throttled group 无限运行修复、util_est 修复 |
| 3 | Ben Segall | ~7 | 竞态条件修复、timer 使用修正 |
| 4 | Aaron Lu | ~7 | Task-based throttle 模型(后半部分)、负载传播 |
| 5 | Kirill Tkhai | ~6 | runtime_enabled 管理、nr_running 修正 |
| 6 | Josh Don | ~6 | Async unthrottle (CSD)、throttled time 统计 |
| 7 | Paul Turner | ~5 | 原始实现(会计、定时器、throttle/unthrottle)、race 消除 |
| 8 | Phil Auld | ~5 | throttle_list 饥饿修复、tick stop 阻塞 |
| 9 | Valentin Schneider | ~4 | Task-based throttle 模型(数据结构、task work、核心切换) |
| 10 | Huaixin Chang | ~4 | Burstable CFS controller |
参与演进过程的所有关键贡献者
Paul Turner, Ben Segall, Peter Zijlstra, Vincent Guittot, Phil Auld, Josh Don, Valentin Schneider, Aaron Lu, Huaixin Chang, Chengming Zhou, Shrikanth Hegde, Xunlei Pang, Odin Ugedal, Kirill Tkhai, Kamalesh Babulal, Frederic Weisbecker, Neil Zhang, Mike Galbraith, Tejun Heo, Chen Yu, Zhang Qiao, Dario Faggioli, Juri Lelli, Byungchul Park, Mel Gorman, Konstantin Khlebnikov, Fernando Sieber, K Prateek Nayak, Michal Koutny, Zhan Xusheng, Zicheng Qu, Vishal Chourasia, Tommaso Cucinotta, Zhen Ni, Joe Salisbury, Abram Hamidi, 等。
核心 API 演变
throttle_cfs_rq() 函数签名演变
| 版本 | 签名 | 说明 |
|---|---|---|
| v3.2 | static __used void throttle_cfs_rq(struct cfs_rq *cfs_rq) | 初始版本,__used 防止编译器警告 |
| v3.2 (d3d9dc33) | static void throttle_cfs_rq(struct cfs_rq *cfs_rq) | 移除 __used,因为已被调用 |
| v5.7 (e98fa02c) | static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) | 改为返回 bool,表示是否实际执行了 throttle |
| v6.18 (e1fad12d) | static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) | 简化:不再遍历 hierarchy 执行 dequeue |
unthrottle_cfs_rq() 函数签名演变
| 版本 | 签名 | 说明 |
|---|---|---|
| v3.2 | static void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) | 初始版本 |
| v3.12 | 不变 | 内部逻辑修复 |
| v6.18 | static void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) | 简化:通过 tg_unthrottle_up re-enqueue 所有 throttled 任务 |
struct cfs_bandwidth 的演变
v3.2 (58088ad0):
raw_spinlock_t lock;
ktime_t period;
u64 quota;
u64 runtime;
s64 hierarchal_quota;
int idle, timer_active;
struct hrtimer period_timer;
struct list_head throttled_cfs_rq;
v4.19 (baa9be4f):
+ bool distribute_running;
v5.7 (ab93a4bc):
- bool distribute_running;
v5.14 (f4183717):
+ u64 burst;
v6.3 (8ad075c2):
... 基本不变 ...
v6.18 (e1fad12d):
... 基本不变(cfs_bandwidth 本身结构不变)...1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
struct cfs_rq 中 throttle 相关字段的演变
v3.2:
int runtime_enabled;
u64 runtime_expires;
s64 runtime_remaining;
int throttled;
struct list_head throttled_list;
v3.7 (f1b17280):
+ u64 throttled_clock, throttled_clock_task;
+ u64 throttled_clock_task_time;
+ int throttle_count;
(throttled_timestamp → throttled_clock)
v4.7 (55e16d30):
- int throttle_uptodate;
v6.3 (8ad075c2):
+ struct list_head throttled_csd_list; // CONFIG_SMP
v6.18 (e1fad12d):
bool throttled:1;
+ bool pelt_clock_throttled:1; // 新增
int throttle_count; (不变)
struct list_head throttled_list; (不变)
struct list_head throttled_csd_list; (不变)
+ struct list_head throttled_limbo_list; // 新增1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
关键 Commit 完整清单
原始实现 (v3.2, Paul Turner)
| Commit | 标题 | 作用 |
|---|---|---|
58088ad0152b | sched: Add a timer to handle CFS bandwidth refresh | 带宽定时器(period_timer) |
ec12cb7f31e2 | sched: Accumulate per-cfs_rq cpu usage and charge against bandwidth | 带宽会计(accounting) |
85dac906bec3 | sched: Add support for throttling group entities | Throttle 执行 |
671fd9dabe52 | sched: Add support for unthrottling group entities | Unthrottle 和 distribution |
d3d9dc330236 | sched: Throttle entities exceeding their allowed bandwidth | 调度路径集成 (check_enqueue_throttle, check_cfs_rq_runtime) |
8cb120d3e41a | sched: Migrate throttled tasks on HOTPLUG | CPU hotplug 兼容 |
PELT 集成 (v3.7~v4.7)
| Commit | 标题 | 作用 |
|---|---|---|
f1b17280efbd | sched: Maintain runnable averages across throttled periods | PELT 时钟冻结 |
55e16d30bd99 | sched/fair: Rework throttle_count sync | throttle_count 同步重构 |
1a55af2e45cc | sched: Update rq clock earlier in unthrottle_cfs_rq | 时钟顺序修复 |
关键修复 (v3.12~v5.7)
| Commit | 标题 | 作用 |
|---|---|---|
f9f9ffc237dd | sched: Avoid throttle_cfs_rq() racing with period_timer stopping | Throttle/timer 竞态 |
db06e78cc13d | sched: Fix cfs_bandwidth misuse of hrtimer_expires_remaining | hrtimer 修复 |
1ee14e6c8cdd | sched: Fix race on toggling cfs_bandwidth_used | cfs_bandwidth_used 竞态 |
c06f04c70489 | sched: Fix potential near-infinite distribute_cfs_runtime() loop | Distribution 循环修复 |
baa9be4ffb55 | sched/fair: Fix throttle_list starvation with low CFS quota | Throttle_list 饥饿 |
512ac999d275 | sched/fair: Fix bandwidth timer clock drift condition | 时钟漂移 |
2a4b03ffc69f | sched/fair: Prevent unlimited runtime on throttled group | 运行时逃逸 |
e98fa02c4f2e | sched/fair: Eliminate bandwidth race between throttling and distribution | Throttle/distribution 竞态消除 |
ab93a4bc955b | sched/fair: Remove distribute_running from CFS bandwidth | 清理 |
Burst 支持 (v5.14)
| Commit | 标题 | 作用 |
|---|---|---|
f4183717b370 | sched/fair: Introduce the burstable CFS controller | 核心 burst 实现 |
bcb1704a1ed2 | sched/fair: Add cfs bandwidth burst statistics | Burst 统计 |
Async Unthrottle (v6.3)
| Commit | 标题 | 作用 |
|---|---|---|
8ad075c2eb1f | sched: Async unthrottling for cfs bandwidth | CSD 异步 unthrottle |
ebb83d84e49b | sched/core: Avoid multiple calling update_rq_clock() in __cfsb_csd_unthrottle() | CSD 优化 |
79462e8c879a | sched: don't account throttle time for empty groups | 空组统计修复 |
677ea015f231 | sched: add throttled time stat for throttled children | 子组统计 |
Task-based Throttle Model (v6.18)
| Commit | 标题 | 作用 |
|---|---|---|
2cd571245b43 | sched/fair: Add related data structure for task based throttle | 数据结构引入 |
7fc2d1439247 | sched/fair: Implement throttle task work and related helpers | Task work 实现 |
e1fad12dcb66 | sched/fair: Switch to task based throttle model | 核心切换 |
eb962f251fbb | sched/fair: Task based throttle time accounting | 时间统计适配 |
5b726e9bf954 | sched/fair: Get rid of throttled_lb_pair() | 移除 throttled_lb_pair |
fe8d238e646e | sched/fair: Propagate load for throttled cfs_rq | 负载传播修复 |
fcd394866e3d | sched/fair: update_cfs_group() for throttled cfs_rqs | Shares 更新修复 |
253b3f587241 | sched/fair: Do not special case tasks in throttled hierarchy | 移除特殊处理 |
0d4eaf8caf8c | sched/fair: Do not balance task to a throttled cfs_rq | 负载均衡修复 |
956dfda6a708 | sched/fair: Prevent cfs_rq from being unthrottled with zero runtime_remaining | 零 runtime unthrottle 防护 |
0e4a169d1a2b | sched/fair: Start a cfs_rq on throttled hierarchy with PELT clock throttled | PELT 初始化修复 |
e34881c84c25 | sched: Re-evaluate scheduling when migrating queued tasks out of throttled cgroups | 迁移后调度重评估 |
演进时间线总览
v3.2 ─── Paul Turner 引入 CFS 带宽控制 (per-CFS_RQ throttle model)
│
v3.7 ─── PELT 时钟冻结支持 (Paul Turner)
│
v3.12 ─── 竞态条件修复 (Ben Segall)
│
v4.7 ─── throttle_count 同步重构 (Peter Zijlstra)
│
v4.19 ─── throttle_list 饥饿修复 (Phil Auld)
│
v5.5 ─── 阻止 throttled group 无限运行 (Vincent Guittot)
│
v5.7 ─── Throttle/distribution 竞态消除 (Paul Turner, Josh Don)
│
v5.14 ─── Burstable CFS controller (Huaixin Chang)
│
v6.3 ─── Async unthrottle via CSD (Josh Don)
│
v6.18 ─── Task-based throttle model (Valentin Schneider, Aaron Lu)
│
└──── Per-task throttle 粒度:消除 lock holder priority inversion1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
参考资料
- Linux 内核源码:
kernel/sched/fair.c、kernel/sched/sched.h、include/linux/sched.h - Paul Turner 原始 patch series (2011): https://lore.kernel.org/lkml/20110721184757.179386821@google.com/
- CFS bandwidth 控制文档:
Documentation/scheduler/sched-bwc.rst - Burstable CFS controller:
Documentation/scheduler/sched-bwc.rst(burst 部分) - Task-based throttle patch series (2025): https://lore.kernel.org/r/20250829081120.806-1-ziqianlu@bytedance.com
所有代码引用来自 Linux 内核源码,遵循 GPL v2 许可。