[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <58055CF8.2060806@hpe.com>
Date: Mon, 17 Oct 2016 19:21:28 -0400
From: Waiman Long <waiman.long@....com>
To: Peter Zijlstra <peterz@...radead.org>
CC: Linus Torvalds <torvalds@...ux-foundation.org>,
Jason Low <jason.low2@....com>,
Ding Tianhong <dingtianhong@...wei.com>,
Thomas Gleixner <tglx@...utronix.de>,
Will Deacon <Will.Deacon@....com>,
Ingo Molnar <mingo@...hat.com>,
Imre Deak <imre.deak@...el.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Davidlohr Bueso <dave@...olabs.net>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Terry Rudd <terry.rudd@....com>,
"Paul E. McKenney" <paulmck@...ibm.com>,
Jason Low <jason.low2@...com>,
Chris Wilson <chris@...is-wilson.co.uk>,
Daniel Vetter <daniel.vetter@...ll.ch>
Subject: Re: [PATCH -v4 8/8] locking/mutex: Enable optimistic spinning of
woken waiter
On 10/07/2016 10:52 AM, Peter Zijlstra wrote:
> @@ -600,7 +630,7 @@ __mutex_lock_common(struct mutex *lock,
> mutex_acquire_nest(&lock->dep_map, subclass, 0, nest_lock, ip);
>
> if (__mutex_trylock(lock, false) ||
> - mutex_optimistic_spin(lock, ww_ctx, use_ww_ctx)) {
> + mutex_optimistic_spin(lock, ww_ctx, use_ww_ctx, false)) {
> /* got the lock, yay! */
> lock_acquired(&lock->dep_map, ip);
> if (use_ww_ctx)
> @@ -669,7 +699,8 @@ __mutex_lock_common(struct mutex *lock,
> * state back to RUNNING and fall through the next schedule(),
> * or we must see its unlock and acquire.
> */
> - if (__mutex_trylock(lock, first))
> + if ((first&& mutex_optimistic_spin(lock, ww_ctx, use_ww_ctx, true)) ||
> + __mutex_trylock(lock, first))
Do we need a __mutex_trylock() here? mutex_optimistic_spin() will do the
trylock and we have one at the top of the loop.
Cheers,
Longman
Powered by blists - more mailing lists