lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <55393CD9.2060703@hp.com>
Date:	Thu, 23 Apr 2015 14:41:29 -0400
From:	Waiman Long <waiman.long@...com>
To:	Peter Zijlstra <peterz@...radead.org>
CC:	Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
	Jason Low <jason.low2@...com>,
	Scott J Norton <scott.norton@...com>,
	Douglas Hatch <doug.hatch@...com>
Subject: Re: [PATCH] locking/rwsem: reduce spinlock contention in wakeup after
 up_read/up_write

On 04/18/2015 11:40 AM, Peter Zijlstra wrote:
> On Fri, Apr 17, 2015 at 10:03:18PM -0400, Waiman Long wrote:
>> @@ -478,7 +515,28 @@ struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem)
>>   {
>>   	unsigned long flags;
>>
>> -	raw_spin_lock_irqsave(&sem->wait_lock, flags);
>> +	/*
>> +	 * If a spinner is present, it is not necessary to do the wakeup.
>> +	 * Try to do wakeup only if the trylock succeeds to minimize
>> +	 * spinlock contention which may introduce too much delay in the
>> +	 * unlock operation.
>> +	 *
>> +	 * In case the spinning writer is just going to break out of the
>> +	 * waiting loop, it will still do a trylock in
>> +	 * rwsem_down_write_failed() before sleeping.
>> +	 * IOW, if rwsem_has_spinner() is true, it will guarantee at least
>> +	 * one trylock attempt on the rwsem.
> successful trylock? I think we're having 'issues' on if failed trylocks
> (and cmpxchg) imply full barriers.
>
>> +	 *
>> +	 *    spinning writer
>> +	 *    ---------------
>> +	 * [S]   osq_unlock()
>> +	 *	 MB
>> +	 * [RmW] rwsem_try_write_lock()
>> +	 */
> Ordering comes in pairs, this is incomplete.

I am sorry that I am a bit sloppy here. I have just sent out an updated 
patch to remedy this. I have added a smp_mb__after_atomic() to ensure 
proper memory ordering. However, I am not so sure if this primitive or 
just a simple smp_rmb() will be more expensive in other non-x86 
architectures.

Cheers,
Longman
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ