On Thu, 3 Aug 2023 at 02:53, Mateusz Guzik mjguzik@gmail.com wrote:
So yes, atomics remain expensive on x86-64 even on a very moden uarch and their impact is measurable in a syscall like read.
Well, a patch like this should fix it.
I intentionally didn't bother with the alpha osf version of readdir, because nobody cares, but I guess we could do this in the header too.
Or we could have split the FMODE_ATOMIC_POS bit into two, and had a "ALWAYS" version and a regular version, but just having a "fdget_dir()" made it simpler.
So this - together with just reverting commit 20ea1e7d13c1 ("file: always lock position for FMODE_ATOMIC_POS") - *should* fix any performance regression.
But I have not tested it at all. So....
Linus