Lockfree fd lookup 0 of 5
Quoted 5 lines · viro
How about this for comparison? That's just a dumb "convert to rwlock" patch; we can be smarter in e.g.
close_on_exechandling, but that's a separate story.
That won't help:
The problem is the cache line trashing from fget() and fget_light() with multithreaded apps. A sequence lock might help, but an rw lock is not a solution.
Actually: 2.4 had an rwlock, it was converted to a spinlock because spinlocks are faster on i386:
read_lock(); short operation(); read_unlock();
is a bit slower than
spin_lock(); short operation(); spin_unlock();
because read_unlock() is a full memory barrier and spin_unlock is not a memory barrier (not necessary because writes are ordered)
--
Manfred