VOOZH about

URL: https://www.phoronix.com/news/Linux-7.0-Faster-Close-Range

⇱ Linux 7.0 Merges "Significant Improvement" For close_range System Call - Phoronix


👁 Phoronix

Linux 7.0 Merges "Significant Improvement" For close_range System Call

Written by Michael Larabel in Linux Kernel on 17 February 2026 at 02:20 PM EST. 7 Comments
The close_range system call for closing all file descriptors "FDs" in a given range should enjoy a nice speed boost with the in-development Linux 7.0 kernel.

Last week saw all the feature-heavy VFS pull requests that brought nullfs and open_tree_namespace, standardized generic I/O error reporting, non-blocking timestamps, and other improvements. Sent out on Monday were some lingering VFS patches mailed out by Christian Brauner.

Notable with the vfs misc 2 pull is optimizing the close_range system call. The close_range usage drops from O(range size) to O(active FDs) with now being more efficient to provide a "significant improvement" for large range close operations on sparse file descriptor tables. Brauner summed it up as:
"Optimize close_range() from O(range size) to O(active FDs) by using find_next_bit() on the open_fds bitmap instead of linearly scanning the entire requested range. This is a significant improvement for large-range close operations on sparse file descriptor tables."

The close_range system call is used to close all file descriptors in a given range on the system.

Qiliang Yuan of China Telecom who authored this patch had similarly wrote:
"In close_range(), the kernel traditionally performs a linear scan over the [fd, max_fd] range, resulting in O(N) complexity where N is the range size. For processes with sparse FD tables, this is inefficient as it checks many unallocated slots.

This patch optimizes __range_close() by using find_next_bit() on the open_fds bitmap to skip holes. This shifts the algorithmic complexity from O(Range Size) to O(Active FDs), providing a significant performance boost for large-range close operations on sparse file descriptor tables."

The code was merged today to Linux Git. A lot of nice work building up for Linux 7.0.

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.