chcpu: a large cpu-list range runs for hours
维护者通常 7 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 42/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 冷清
- 技术栈
- rust
- 领域
- cli, operating-systems
调研方向
从 chcpu 处理 CPU 列表的入口点开始,复现 issue 中描述的大范围行为。issue 没有指定源文件或测试,并且可接受的上限尚未确定。完成的标准是:对于 --enable 和 --disable,超大的范围都能被及时拒绝,而不会进行数小时的迭代或产生过多诊断信息。
由索引模型根据 Issue 内容生成。
描述
chcpu walks every index in a cpu-list range, and the range is bounded only by the integer type, so it is easy to write one that will not finish. On main (7476fce), x86_64, 24 CPUs online:
$ time chcpu --enable 0-400000 >/dev/null 2>&1
real 0m1.658s
$ timeout 60 chcpu --enable 0-4294967295 >/dev/null 2>&1; echo $?
124
That is roughly 241,000 indices per second, so 0-4294967295 needs about five hours.
It is also loud. Every nonexistent index gets its own line on stderr; for the example above, redirected to a file, that is about 130 GB.
--disable takes the same path, and run as root it will offline the CPUs that do exist before it starts working through the ones that do not.
util-linux 2.42.2 rejects the same input immediately:
$ chcpu --enable 0-4294967295
chcpu: invalid CPU number in CPU list: 0-4294967295
$ echo $?
1
I have not worked out what a sensible upper bound would be. There is more than one defensible choice, so it seemed better to raise this than to suggest one. Happy to implement whichever bound gets settled on.
- 主要语言
- Rust
- 星标
- 221
- 派生
- 60
- 平均合并
- 2 天 19 小时
- 30 天内合并 PR
- 10
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
uutils/util-linux 的其他 Issue
-
Implement `chrt`未关闭
难度 4/5 3-5 天 新手友好度 48/100
uutils/util-linux#641 ·
维护者通常 7 天内回复
-
难度 3/5 1-2 天 新手友好度 35/100
uutils/util-linux#638 ·
维护者通常 7 天内回复
-
难度 3/5 1-2 天 新手友好度 55/100
uutils/util-linux#629 ·
维护者通常 7 天内回复
-
难度 4/5 3-5 天 新手友好度 25/100
uutils/util-linux#624 ·
维护者通常 7 天内回复
-
难度 4/5 3-5 天 新手友好度 38/100
uutils/util-linux#558 ·
维护者通常 7 天内回复
查看 uutils/util-linux 的全部 Issue
相似的 Issue
-
area:casework bug criticality:p3 triage:needs-implementation
难度 2/5 1-3 小时 新手友好度 84/100
registrystack/registry-stack#1623 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
DioxusLabs/anyrender#98 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
leptos-rs/leptos#4885 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
longbridge/gpui-kit#3276 ·
维护者通常 1 天内回复