[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160212204027.GZ6357@twins.programming.kicks-ass.net>
Date: Fri, 12 Feb 2016 21:40:27 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Waiman Long <Waiman.Long@....com>
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 Fri, Feb 12, 2016 at 12:32:12PM -0500, Waiman Long wrote:
> @@ -358,8 +373,8 @@ static bool mutex_optimistic_spin(struct mutex *lock,
> }
>
> mutex_set_owner(lock);
> - osq_unlock(&lock->osq);
> - return true;
> + acquired = true;
> + break;
> }
>
> /*
> @@ -380,7 +395,10 @@ static bool mutex_optimistic_spin(struct mutex *lock,
> cpu_relax_lowlatency();
> }
>
> - osq_unlock(&lock->osq);
> + if (!waiter)
> + osq_unlock(&lock->osq);
> + if (acquired || waiter)
> + return acquired;
> done:
> /*
> * If we fell out of the spin path because of need_resched(),
Is there a reason to not also preempt in the wait-loop? Surely the same
reason is still valid there too?
Powered by blists - more mailing lists