News: 0001614107

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

Linux 7.0 Merges "Significant Improvement" For close_range System Call

([Linux Kernel] 4 Hours Ago close_range)


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 [1]Linux 7.0 kernel.

Last week saw all the feature-heavy VFS pull requests that brought [2]nullfs and open_tree_namespace , [3]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 [4]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 [5]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.



[1] https://www.phoronix.com/search/Linux+7.0

[2] https://www.phoronix.com/news/Linux-7.0-NULLFS-Namespace

[3] https://www.phoronix.com/news/Linux-7.0-VFS

[4] https://lore.kernel.org/lkml/20260216-vfs-misc-2-v70-fd637c6f249a@brauner/

[5] https://lore.kernel.org/all/20260123081221.659125-1-realwujing@gmail.com/



Our congratulations go to a Burlington Vermont civilian employee of the
local Army National Guard base. He recently received a substantial cash
award from our government for inventing a device for optical scanning.
His device reportedly will save the government more than $6 million a year
by replacing a more expensive helicopter maintenance tool with his own,
home-made, hand-held model.

Not surprisingly, we also have a couple of money-saving ideas that we submit
to the Pentagon free of charge:

(a) Don't kill anybody.
(b) Don't build things that do.
(c) And don't pay other people to kill anybody.

We expect annual savings to be in the billions.
-- Sojourners