Re: performance delta after VFS i_mutex=>i_rwsem conversion

From: Ingo Molnar
Date: Thu Jun 09 2016 - 06:26:17 EST



* Ingo Molnar <mingo@xxxxxxxxxx> wrote:

>
> * Waiman Long <waiman.long@xxxxxxx> wrote:
>
> > I do have a patchset that allow us to more accurately determine the state of
> > the lock owner.
> >
> > locking/rwsem: Add reader-owned state to the owner field
> > http://www.spinics.net/lists/kernel/msg2258572.html
> >
> > That should eliminate the performance gap between mutex and rwsem wrt
> > spinning when only writers are present. I am hoping that that patchset can
> > be queued for 4.8.
>
> Yeah, so I actually had this series merged for testing last week, but a
> complication with a prereq patch made me unmerge it. But I have no fundamental
> objections, at all.
>
> I also agree with Linus's general observation that we want to make
> down_write()/up_write() match mutex performance characteristics.
>
> I think kernel developers should fundamentally be able to switch between
> mutex_lock()/unlock() and down_write()/up_write() and back, without noticing
> any high level behavioral changes.

Ok, these enhancements are now in the locking tree and are queued up for v4.8:

git pull git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core

Dave, you might want to check your numbers with these changes: is rwsem
performance still significantly worse than mutex performance?

Thanks,

Ingo