Linux Kernel Performance Bottlenecks Spotted By Mold Developer
Open-source developer Rui Ueyama who is the lead developer of the Mold high performance linker and previously on the LLVM lld linker has written a detailed mailing list post that highlights some observed performance bottlenecks within the Linux kernel.
In developing the high speed Mold linker that sharply outperforms the GNU and LLVM linkers, Rui has noticed some areas of the Linux kernel becoming a bottleneck for the linker. The hope is these areas could be improved upon within the Linux kernel moving forward for allowing even better performance.
The key takeaways of the performance bottlenecks within the Linux kernel that were noticed by Rui Ueyama include:
- exit(2) takes a few hundred milliseconds for a large process
- Writing to a fresh file is slower than writing to an existing file
- Lack of a safe system-wide semaphore
The observation of a fresh file being slower than writing to an existing file is interesting and Rui elaborated:
Those interested in all the details noticed by the Mold developer around the Linux kernel can be found via this Linux kernel mailing list thread.
In developing the high speed Mold linker that sharply outperforms the GNU and LLVM linkers, Rui has noticed some areas of the Linux kernel becoming a bottleneck for the linker. The hope is these areas could be improved upon within the Linux kernel moving forward for allowing even better performance.
The key takeaways of the performance bottlenecks within the Linux kernel that were noticed by Rui Ueyama include:
- exit(2) takes a few hundred milliseconds for a large process
- Writing to a fresh file is slower than writing to an existing file
- Lack of a safe system-wide semaphore
The observation of a fresh file being slower than writing to an existing file is interesting and Rui elaborated:
"mold can link a 4 GiB LLVM/clang executable in ~1.8 seconds on my machine if the linker reuses an existing file and overwrites it. However, the speed decreases to ~2.8 seconds if the output file does not exist and mold needs to create a fresh file. I tried using fallocate(2) to preallocate disk blocks, but it didn't help. While 4 GiB is not small, should creating a file really take almost a second?"
Those interested in all the details noticed by the Mold developer around the Linux kernel can be found via this Linux kernel mailing list thread.
33 Comments