林纳斯·托瓦兹的首个 LLM 辅助补丁系列
Linus Torvalds's first LLM-assisted patch series

原始链接: https://lwn.net/Articles/1100449/

[由 corbet 于 2026 年 10 月 14 日发布] 在最近结束的维护者峰会上,Linus Torvalds 表示,他一直在使用一个大语言模型来开发一个补丁系列,以解决一个长期存在的问题;他现在已经将该系列发出来供审查。这个相当短的、由十个补丁组成的系列,基本上通过识别 folio 何时是热的来增强 folio 查找,并设置“将该 folio 的释放延迟到 RCU 周期之后”,然后利用这个 RCU 延迟,它不仅把 folio 查找本身放在 RCU 下进行(这一点我们一直都这么做),还把实际的 folio 数据访问本身也放在 RCU 下进行。在快速路径上不需要获取引用计数;当用户复制不会引发缺页异常时,我们可以完全在 RCU 保护的区域内从 folio 读取数据。最终结果是,对于以 read() 为主的基准测试,速度提升了一个数量级。不过,审查已经发现代码中存在一个竞态条件,因此还需要进一步的工作。

Hacker News 上的讨论涉及 Linus Torvalds 在其指导下使用 Claude Code 完成的 Linux 内核首个 LLM 辅助补丁系列。差异规模中等且可读,但人工审查发现了一个竞态条件。评论者指出,Linus 现在主要管理和审查代码,而不是编写代码,因此 LLM 辅助很自然地契合。争论集中在版权:机器生成代码可能不受版权保护,因此内核政策要求显著的人类作者身份。一些人赞扬 Linus 的务实——为了质量选择 Claude 而非开放模型——而另一些人则担忧 AI 对社会和环境的影响、代码质量,以及“slop”进入关键基础设施的风险。少数人认为 AI 工具进步迅速,可以加速调试和修补。总体而言,该讨论串反映了社区对 AI 在开源开发中日益增长的角色既分裂又积极参与。
相关文章

原文
At the recently concluded Maintainers Summit, Linus Torvalds said that he had been using a large language model to work on a patch series addressing a longstanding problem; he has now posted that series for review.
The fairly short series of ten patches basically enhances folio lookup by noticing when folios are hot, and setting a "delay releasing this folio until after a RCU period", and then using that RCU delay it does not just the folio lookup itself under RCU (which we've done forever), but also the actual folio data accesses themselves under RCU. No refcount taking needed for the fastpath where we can just read the data from the folio entirely in an RCU-protected region when the user copy doesn't cause page faults.

The end result is an order-of-magnitude speedup for a read()-heavy benchmark. Review has already identified a race condition in the code, though, so further work will be needed.


联系我们 contact @ memedata.com