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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 15 Feb 2016 17:06:52 -0500
From:	Waiman Long <waiman.long@....com>
To:	Peter Zijlstra <peterz@...radead.org>
CC:	Ingo Molnar <mingo@...hat.com>, <linux-kernel@...r.kernel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Ding Tianhong <dingtianhong@...wei.com>,
	Jason Low <jason.low2@....com>,
	Davidlohr Bueso <dave@...olabs.net>,
	"Paul E. McKenney" <paulmck@...ibm.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Will Deacon <Will.Deacon@....com>,
	Tim Chen <tim.c.chen@...ux.intel.com>,
	Waiman Long <Waiman.Long@...com>
Subject: Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

On 02/12/2016 03:23 PM, Peter Zijlstra wrote:
> On Fri, Feb 12, 2016 at 12:32:12PM -0500, Waiman Long wrote:
>> This patch adds a new waiter parameter to the mutex_optimistic_spin()
>> function to prepare it to be used by a waiter-spinner that doesn't
>> need to go into the OSQ as there can only be one waiter-spinner which
>> is the head of the waiting queue.
> Does not explain why..
>
>>   static bool mutex_optimistic_spin(struct mutex *lock,
>> +				  struct ww_acquire_ctx *ww_ctx,
>> +				  const bool use_ww_ctx, int waiter)
>>   {
>>   	struct task_struct *task = current;
>> +	bool acquired = false;
>>
>> +	if (!waiter) {
>> +		if (!mutex_can_spin_on_owner(lock))
>> +			goto done;
> Why doesn't the waiter have to check mutex_can_spin_on_owner() ?

The reason why regular spinner need to call mutex_can_spin_on_owner is 
because we want to avoid the overhead of the OSQ if  we can't spin. As 
mutex_can_spin_on_owner() is similar to mutex_spin_on_owner(), the 
waiter-spinner will exit spinning after calling mutex_spin_on_owner().

Cheers,
Longman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ