Linus Torvalds Uses Claude Code to Redesign Page‑Cache Release Path

By the end of this article the reader will understand how Linus Torvalds employed the Claude Code large‑language‑model assistant to prototype a new kernel feature, why the shift from reference‑counted page‑cache handling to an RCU‑based approach is technically significant, and what the change implies for kernel developers and system administrators who track upcoming kernel releases.

Background: AI in Kernel Development

The Linux kernel community has long tolerated the use of artificial‑intelligence tools for debugging assistance. Linus Torvalds has publicly endorsed that practice, emphasizing that AI can surface bugs faster than manual inspection. Until recently, the scope of AI assistance remained confined to error detection and code‑review support. The recent patch series marks the first documented instance of an LLM being used to generate substantive kernel functionality under Torvalds’ direct supervision.

Claude Code as a Coding Partner

Torvalds’ patch message explicitly attributes the generation of code, test programs, and the initial draft of accompanying documentation to Claude Code, an LLM coding assistant. The statement also notes that performance measurements were executed on Torvalds’ own workstation, indicating a closed‑loop workflow where the AI‑produced code is immediately validated on the developer’s hardware. This approach mirrors a “pair‑programming” model, with the LLM supplying candidate implementations that are then vetted by the kernel maintainer.

The noref‑filemap‑read‑with‑llm Patch

The concrete change under discussion resides in the patch series titled noref‑filemap‑read‑with‑llm. The underlying idea, originally proposed by Torvalds, concerns the lifecycle of a folio—a unit of memory representing a contiguous range of pages—once it is removed from the page cache. Traditionally, the kernel increments a reference count for each active reader of a folio, and the memory is returned to the page allocator only after the last reference is released. This reference‑counting scheme introduces contention under heavy read workloads because each CPU must atomically modify the counter.

Claude Code suggested an alternative that replaces per‑reader reference counting with a lock‑free Read‑Copy‑Update (RCU) mechanism. In the new design, readers access the folio without acquiring a lock or incrementing a counter. When a writer removes a folio from the cache, it schedules the memory for deferred reclamation after an RCU grace period, ensuring that any in‑flight readers have completed before the pages are recycled. The result is a model that relies on RCU’s deferred memory‑freeing semantics rather than explicit reference tracking.

Technical Implications of the RCU Shift

Replacing reference counting with RCU has several measurable effects on kernel behavior:

  • Reduced CPU contention: Atomic increment/decrement operations on a shared counter generate cache‑line bouncing, especially on systems with many cores. RCU read sections are read‑only and execute without atomic updates, eliminating that source of inter‑CPU traffic.
  • Lock‑free read paths: By avoiding locks entirely, the read path can scale more predictably under high concurrency, a property already leveraged in other kernel subsystems such as the networking stack and the scheduler.
  • Deferred reclamation guarantees: RCU’s grace‑period semantics ensure that memory is not reclaimed until all pre‑existing readers have exited, preserving correctness without explicit reference bookkeeping.
  • Potential latency trade‑offs: The writer must wait for an RCU grace period before the pages can be reused, which may introduce a bounded delay in scenarios with continuous read traffic. However, the kernel’s existing RCU infrastructure already tolerates such delays in many contexts.

The patch series therefore addresses a specific performance bottleneck—heavy CPU locking caused by per‑reader reference counting—by leveraging a synchronization primitive that the kernel already employs extensively. The change does not introduce new APIs; instead, it re‑architects the internal handling of page‑cache folios to align with established RCU patterns.

Impact on Kernel Development Workflow

Torvalds’ public use of an LLM for feature development signals a shift in how kernel contributors might incorporate AI tools. The workflow demonstrated includes:

  1. Formulating a design hypothesis (e.g., “a folio removed from the page cache should return to the allocator after an RCU grace period”).
  2. Prompting the LLM to produce a draft implementation, accompanying test harnesses, and initial documentation.
  3. Running performance measurements on a local machine to assess the impact of the change.
  4. Iterating on the code under the maintainer’s direction, with the LLM serving as a rapid prototyping assistant.

For developers, this workflow reduces the time spent on boilerplate coding and test scaffolding, allowing more focus on algorithmic design and performance evaluation. For maintainers, the approach provides a concise, reproducible starting point that can be reviewed and refined without sacrificing code quality, as the final patches still undergo the standard review process.

Practical Considerations for System Administrators

Although the patch series has not yet been merged into the forthcoming 7.4 kernel, its potential inclusion carries implications for administrators who monitor kernel performance characteristics. The RCU‑based folio release path may affect metrics such as page‑cache turnover latency and CPU utilization under read‑heavy workloads. Administrators should be prepared to observe the following when the change lands:

  • Adjusted performance baselines: Benchmarks that previously highlighted lock contention in the page‑cache subsystem may show improved scalability, particularly on multi‑core servers.
  • RCU tuning relevance: Existing RCU configuration parameters (e.g., grace‑period length) could influence the latency of folio reclamation. Administrators may need to revisit RCU tuning guidelines to align with the new code path.
  • Compatibility checks: Since the change modifies internal memory‑management semantics, downstream distributions will need to validate that the altered behavior does not interfere with custom kernel modules that rely on the former reference‑counting contract.

In practice, the transition should be transparent to end users; the kernel’s external interfaces remain unchanged. However, administrators who compile custom kernels or apply backports should track the patch’s progression through the release candidate cycle to ensure that any required adjustments are made before deployment in production environments.

Broader Significance for the Open‑Source Ecosystem

Torvalds’ adoption of Claude Code underscores a growing acceptance of AI‑driven development within the open‑source community. The episode demonstrates that an LLM can contribute beyond bug‑finding, extending to architectural redesigns that touch core synchronization mechanisms. This may encourage other maintainers to experiment with AI assistance for feature work, provided that the standard review and testing rigor is maintained.

The episode also highlights the importance of transparent communication. By explicitly noting that the code, tests, and initial documentation were generated with an LLM, Torvalds sets a precedent for clear attribution of AI contributions, which can aid downstream auditors and maintainers in assessing the provenance of code changes.

What to Watch for in Upcoming Kernel Releases

The patch series is currently hosted in a separate branch, and its inclusion in the 7.4 kernel remains undecided. Stakeholders should monitor the following signals:

  • Upstream merge decisions during the 7.4 release candidate cycle.
  • Performance regression testing reports that compare the RCU‑based path against the legacy reference‑counted implementation.
  • Community discussions regarding the impact on existing kernel modules that interact with the page‑cache subsystem.

A successful merge would represent both a technical improvement to page‑cache handling and a proof‑of‑concept for AI‑assisted kernel feature development. Administrators and developers alike would benefit from early awareness of the change, allowing them to plan testing and integration strategies ahead of the next stable kernel release.

Source: linux-magazine.com

AI‑Assisted Kernel Build Optimizations: What Linux Developers Learned

By the end of this article readers will understand how an AI‑driven workflow identified and mitigated single‑threaded bottlenecks in the Linux kernel build process, the concrete impact on various build configurations, and the practical implications for kernel maintainers and system integrators when incorporating large‑language‑model (LLM) assistance into code‑base modifications.

Background: Build‑time Bottlenecks in the Kernel

Compiling the Linux kernel is a multi‑stage operation that involves preprocessing, symbol generation, linking, and post‑processing steps such as Kbuild, kallsyms, modpost, objtool, and mksysmap. While the kernel’s source tree is highly parallelizable, several stages historically remain single‑threaded, creating a “frustratingly large amount of time” for full builds, especially on systems with many cores. The performance gap becomes more pronounced for incremental builds (where only a subset of files changes) and for “noop” builds that perform no actual compilation but still run the full build script to verify dependencies.

AI‑Guided Identification of Hotspots

Lorenzo Stoakes, a developer at Arm, approached the problem by consulting a large‑language‑model to locate the most time‑consuming sections of the build pipeline. The LLM suggested specific code paths where parallelism could be introduced or where existing algorithms could be streamlined. This initial analysis produced a set of patches targeting the aforementioned components, with a focus on reducing serialization points.

Generated Code and the “Hideous” Reality Check

The LLM output consisted of extensive code modifications. According to Stoakes, much of this generated code was “hideous,” meaning it required significant manual refinement before integration. The development workflow therefore included a thorough audit, rewriting of large portions, and extensive editing of commit metadata—cover letters, commit messages, and inline comments—to align the changes with kernel coding standards and maintainability expectations.

Measured Impact on Build Performance

After the manual verification and integration of the revised patches, Stoakes reported measurable improvements across three common build scenarios:

  • Allmodconfig builds—where every configurable option is enabled—completed up to 36 % faster.
  • Incremental builds—rebuilding after a small code change—showed speedups of roughly 70 %.
  • Noop builds—executing the build system without actual compilation—experienced up to a 90 % reduction in runtime.

These figures were confirmed through manual verification rather than automated benchmarking, underscoring the practical relevance of the optimizations for developers who frequently iterate on kernel code.

Technical Changes Introduced

The patches altered several subsystems:

  • Kbuild—enhanced parallel execution of make targets, reducing the sequential bottleneck in dependency resolution.
  • Kallsyms—restructured symbol table generation to allow concurrent processing of symbol groups.
  • Modpost—refactored module post‑processing to avoid global locks during metadata aggregation.
  • Objtool—introduced batch processing of object files, decreasing per‑object overhead.
  • Mksysmap—optimized the creation of the system map by parallelizing address sorting.
  • Rust build system—applied similar parallelization concepts to the emerging Rust components within the kernel.

Each change was designed to either split a previously monolithic loop into independent work units or replace a blocking data structure with a lock‑free alternative where feasible. The net effect was a more scalable build pipeline that better utilizes modern multi‑core hardware.

Implications for Kernel Maintainers

The successful use of an LLM in this context demonstrates a viable, albeit labor‑intensive, workflow for large‑scale codebase refactoring. However, the experience also highlights several considerations for maintainers:

  1. Audit Overhead—AI‑generated patches cannot be merged without rigorous human review. The “hideous” nature of the initial output necessitated extensive rewriting, implying that developers must allocate sufficient time for code hygiene and style compliance.
  2. Commit Attribution—Every commit resulting from the LLM assistance carries an “Assisted‑by” tag. This explicit attribution aids traceability and aligns with open‑source contribution policies that require clear provenance.
  3. Testing Discipline—Manual verification of performance gains was essential. Automated test suites should be expanded to include build‑time regression tests to catch inadvertent slowdowns introduced by future changes.
  4. Documentation Updates—Given the breadth of affected subsystems, corresponding documentation (e.g., Kbuild manuals, developer guides) must be refreshed to reflect new parallelization pathways and any altered build flags.

Practical Takeaways for System Administrators and Power Users

While the patches target kernel developers, the downstream effects are relevant to anyone who compiles custom kernels or maintains build farms:

  • Reduced Build Windows—Faster all‑modconfig builds free up CI resources, allowing more frequent integration cycles.
  • Accelerated Development Loops—Incremental build speedups translate directly into shorter edit‑compile‑test cycles for kernel contributors.
  • Resource Efficiency—Noop build reductions mean that validation steps (e.g., checking configuration consistency) consume fewer CPU cycles, lowering operational costs on shared build servers.

Administrators managing large build clusters should consider updating their build scripts to incorporate the new parallelism flags introduced by the patches. This may involve adjusting the MAKEFLAGS environment variable or invoking specific make targets that leverage the enhanced concurrency.

Future Directions and Cautions

The experiment underscores the potential of AI assistance in large‑scale software engineering, yet it also serves as a cautionary tale. The quality of AI‑generated code varies, and without disciplined review, the risk of introducing subtle bugs or regressions remains high. Moreover, the necessity of extensive manual rewriting suggests that current LLMs are better suited as idea generators rather than direct code authors for critical system components.

Going forward, the kernel community may benefit from establishing guidelines for AI‑assisted contributions, including mandatory tagging, review checkpoints, and performance verification protocols. Such frameworks would help balance the speed gains from AI suggestions with the rigor required for a project of the Linux kernel’s scale and importance.

Source: linux-magazine.com

Tenstrorrent Releases GCC Patches for Ascalon XG Core

By the end of this article readers will understand the significance of Tenstrorrent’s recent GCC compiler patches for the Ascalon XG core, how the changes affect compilation workflows, and what steps administrators and developers should consider when integrating the updates into their Linux toolchains.

Background on the announcement

Tenstrorrent has posted a set of patches to the GNU Compiler Collection (GCC) that target the Ascalon XG core. The core in question is a hardware component whose compilation support has historically required workarounds in the compiler backend. By providing upstream patches, Tenstrorrent moves the support from a vendor‑specific patch set to a form that can be merged into future GCC releases.

Technical implications of the patches

The primary technical impact lies in the compiler’s ability to generate correct and optimized machine code for the Ascalon XG architecture without manual intervention. Prior to the patches, developers often needed to apply custom flags or maintain a forked GCC version to avoid miscompilation. The new patches address those gaps by updating instruction selection patterns, register allocation rules, and intrinsic handling specific to the XG core.

From a performance perspective, the changes enable the optimizer to better exploit the core’s instruction set, potentially improving execution efficiency for workloads that are compiled with the updated GCC. Additionally, the patches reduce the risk of subtle bugs that can arise when the compiler emits instructions unsupported by the hardware, thereby enhancing overall system stability.

Impact on build environments

For administrators maintaining build farms or continuous integration pipelines, the availability of upstream patches simplifies the toolchain management process. Instead of tracking a separate patch repository, the patches can be incorporated into the standard GCC source tree and built alongside other components. This reduces the maintenance overhead associated with custom compiler builds and aligns the build environment with the broader GCC community.

Developers targeting the Ascalon XG core will see a more predictable compilation experience. The need to specify obscure compiler flags or to test against a patched GCC binary diminishes, allowing source code to be compiled with the default toolchain configuration. This also improves reproducibility across different development machines and CI runners.

Practical steps for administrators and developers

While the source material does not provide explicit integration instructions, the typical workflow for incorporating upstream GCC patches involves fetching the latest GCC source, applying the patch series, and rebuilding the compiler. Administrators should schedule this rebuild during a maintenance window, ensuring that a backup of the existing GCC binaries is retained in case a rollback is required.

Once the patched GCC is installed, verification can be performed by compiling a small test program with the target architecture flag for Ascalon XG and confirming that the resulting binary runs without illegal instruction errors. Successful verification indicates that the compiler now correctly understands the core’s instruction set.

In environments where multiple GCC versions coexist, it is advisable to update the default compiler symlink only after thorough testing, thereby preventing inadvertent breaks in existing build pipelines that rely on older compiler behavior.

For developers, the immediate benefit is the ability to remove custom build scripts that previously injected the Tenstrorrent patch set manually. Codebases can be streamlined to use the standard GCC invocation, which improves portability and reduces the cognitive load associated with maintaining architecture‑specific build logic.

Source: phoronix.com

Popular Posts

Install Ollama and Open WebUI on Ubuntu 24.04 with NVIDIA GPU Acceleration (Step-by-Step)

Install a Local AI Chatbot on Ubuntu 24.04 with Ollama and Open WebUI (Step-by-Step)

Install Ollama + Open WebUI on Ubuntu 24.04 with NVIDIA GPU Acceleration (Step-by-Step)

Trending Now

Homogeneous Nucleation on Mars: A Textbook Process Finally Observed in Nature

By the end of this piece, you will understand what the Arsia Mons Elongated Cloud is, why it resisted explanation for several years after its first observation, and what the newly published model reveals about a physical process that has never been directly confirmed on any planet's atmosphere. The cloud that broke the model Every morning during Martian spring and summer, a thin, extremely long cloud forms near the Arsia Mons volcano and gradually elongates until it stretches to more than 1,000 miles before dissipating. The cycle then repeats for several months. The formation was first recorded by a probe in 2018, and from that point onward it became a persistent puzzle for atmospheric scientists working with Mars data. The cloud's geometry, its timing, and its seasonal recurrence all pointed to a real and reproducible physical process, yet no existing model could reproduce it. For a technical audience familiar with simulation work, the situation is analogous to a product...