kernel-os

Meta engineer reworks Torvalds' AI-assisted page cache patches, shows large gains

Key Takeaway

A Meta engineer has reworked Linus Torvalds' AI-generated Linux kernel patches for reading from the page cache without folio references, achieving substantial performance improvements across EXT4, TMPFS, and XFS.

Summary

Last week Linus Torvalds used Claude Code to generate kernel patches that read from the page cache without folio references, targeting workloads with many small reads from a single file across multiple CPU threads. Meta engineer Kiryl Shutsemau has now reworked that code and published a patch series showing significant performance gains. Testing on a 64-thread AMD Ryzen Threadripper with EXT4, TMPFS, XFS, and raw block devices showed strong improvements, including with CPU security mitigations disabled. The patches remain in RFC status with open design questions.

What the reworked patches change

  • Eliminates folio refcount bouncing: Multiple CPUs doing small reads from one file no longer take and drop references on the same folio, avoiding cache-line contention on the reference count.
  • RCU-based freeing: Folios that readers may copy from are freed only after an RCU grace period, ensuring safety without the reference.
  • Modified functions: filemap_read() and shmem copy paths are adapted to copy from page cache without taking a folio reference.
  • Test coverage: Benchmarked across EXT4, TMPFS, XFS, and raw block device with 64 threads on AMD Ryzen Threadripper.
  • Security mitigations tested: Results measured both with default CPU mitigations enabled and disabled.

Why it matters

If merged, this would improve throughput for a common class of I/O-heavy workloads—many small concurrent reads from the same file—without requiring application changes. The collaboration also demonstrates a viable path for AI-assisted kernel development followed by expert human refinement.

Original reference: www.phoronix.com →

Ask AI & Compare Archive