Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1502948
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH -v4 8/8] locking/mutex: Enable optimistic spinning of woken waiter |
| Date | 2016-10-18 14:30 +0200 |
| Message-ID | <stBGO-1Bc-11@gated-at.bofh.it> (permalink) |
| References | <spEWB-2dt-5@gated-at.bofh.it> <spFfX-2lv-31@gated-at.bofh.it> <stBGO-1Bc-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Oct 17, 2016 at 07:21:28PM -0400, Waiman Long wrote:
> 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.
Yes, mutex_optimistic_spin() can be a no-op.
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH -v4 8/8] locking/mutex: Enable optimistic spinning of woken waiter Peter Zijlstra <peterz@infradead.org> - 2016-10-18 14:30 +0200
csiph-web