Re: [PATCH -v9][RFC] mutex: implement adaptive spinning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2009-01-13 at 08:16 -0800, Linus Torvalds wrote:
> 
> On Tue, 13 Jan 2009, Peter Zijlstra wrote:
> > 
> > Change mutex contention behaviour such that it will sometimes busy wait on
> > acquisition - moving its behaviour closer to that of spinlocks.
> 
> Okey, dokey. Looks reasonable, but I wonder if this part came from v8 and 
> wasn't intentional:
> 
> > +		if (atomic_xchg(&lock->count, -1) == 1) {
> > +			lock_acquired(&lock->dep_map, ip);
> > +			mutex_set_owner(lock);
> > +			preempt_enable();
> > +			return 0;
> > +		}
> 
> Now you're forcing the slow-path on unlock. Maybe it was intentional, 
> maybe it wasn't. Did you perhaps mean
> 
> 	if (atomic_cmpxchg(&lock->count, 1, 0) == 1) {
> 
> here? I thought we agreed it was safe, if only because it should be 
> equivalent to just having done "mutex_trylock()" instead of a "real" lock 
> sequence.

Yes, that was an 'accident' from -v8, yes we did think the cmpxchg was
good, however I did get some spurious lockups on -v7, and I only noticed
the thing after I'd done most of the testing, so I decided to let it be
for now.

Let me put the cmpxchg back in and see if this is all still good (only
3*2*2 configs to test :-).
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux