[clang] [clang][modules] Timestamp PCM files when writing (PR #112452)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 16 09:29:10 PDT 2024


jansvoboda11 wrote:

The issue with the current state of things in Clang is that if you have N instances waiting for a PCM file to be built, they all load the PCM file as soon as the lock is released by the writer. They all find out that there's no timestamp file and attempt to write it after they validate the input files. This is what causes lots of concurrent IO.

If you instead write the timestamp file once while still holding the writer lock, the N waiting Clang instances don't attempt to write the timestamp file, because one has already been written in the current build session. This ends up being much faster  by alleviating lock contention in the kernel.

The logic that avoids unnecessary validation of system headers when the timestamp file exists works just fine before and after this patch. It's just the process of creating the timestamp file that's the issue here.

https://github.com/llvm/llvm-project/pull/112452


More information about the cfe-commits mailing list