On Thu 19-10-17 15:44:31, Darrick J. Wong wrote: > On Thu, Oct 19, 2017 at 03:14:07PM +0200, Christoph Hellwig wrote: > > On Thu, Oct 19, 2017 at 07:38:48AM -0400, Brian Foster wrote: > > > On Thu, Oct 19, 2017 at 09:47:05AM +0200, Christoph Hellwig wrote: > > > > Apparently our current rwsem code doesn't like doing the trylock, then > > > > lock for real scheme. So change our read/write methods to just do the > > > > trylock for the RWF_NOWAIT case. This fixes a ~25% regression in > > > > AIM7. > > > > > > > > > > The code looks fine, but this seems really strange. If the trylock > > > fails, then wouldn't the blocking lock have slept anyways if done > > > initially? Is there any more background info available on this, or > > > perhaps a theory on why there is such a significant regression..? > > > > No, unfortunately I don't have a theory, but I agree it is odd > > behavior in the rwsem code. > > <shrug> I want to know a little more about why there's a performance hit > in the down_read_trylock -> down_read case. Are we getting penalized > for that? Is it some weird interaction with lockdep? At least on x86, __down_read_trylock() is implemented very much differently from __down_read(). In particular if there's heavy contention on the semaphore from readers, __down_read_trylock() implementation seems to be prone to going through cmpxchg loop several times which could explain observed performance data. But I'm just guessing... Adding some x86 people to CC just in case they have more to say. Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html