Linux 6.10 Improves Performance For Opening Unencrypted Files

Written by Michael Larabel in Linux Storage on 17 May 2024 at 08:37 AM EDT. 5 Comments
LINUX STORAGE
FSCRYPT is the file-system encryption framework within the Linux kernel for supporting optional encryption on file-systems like EXT4, F2FS, and others. With Linux 6.10 an optimization is coming for enhancing the performance of opening files on file-systems supporting FSCRYPT-based encryption but when the files are unencrypted.

As a missed optimization until now, a lone new patch is making up the FSCRYPT changes for Linux 6.10. Mateusz Guzik uncovered a rather expensive oversight in handling of unencrypted files on file-systems like EXT4 that support FSCRYPT. He explained in the patch:
"fscrypt: try to avoid refing parent dentry in fscrypt_file_open

Merely checking if the directory is encrypted happens for every open when using ext4, at the moment refing and unrefing the parent, costing 2 atomics and serializing opens of different files.

The most common case of encryption not being used can be checked for with RCU instead.

Sample result from open1_processes -t 20 ("Separate file open/close") from will-it-scale on Sapphire Rapids (ops/s):
before: 12539898
after: 25575494 (+103%)"

Quite a significant boost to the file open performance for these common Linux file-systems supporting FSCRYPT encryption but not necessarily used.

FSCRYPT performance win


This file open performance optimization for unencrypted files on FSCRYPT-supported file-systems is merged via this pull request for the ongoing Linux 6.10 merge window.
Related News
About The Author
Michael Larabel

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.

Popular News This Week