All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/12] locking/ww_mutex: Keep sorted wait list to avoid stampedes
@ 2016-12-21 18:46 Nicolai Hähnle
  2016-12-21 18:46   ` Nicolai Hähnle
                   ` (11 more replies)
  0 siblings, 12 replies; 29+ messages in thread
From: Nicolai Hähnle @ 2016-12-21 18:46 UTC (permalink / raw)
  To: linux-kernel

Here's a v3 of the series. Some comments:

Patch #1 is already in drm-misc, but I left it here for now for completeness.

Patch #2 is new and affects all types of locks, not just the w/w case. It's
a race that is exceedingly unlikely: basically, we have to be interrupted
right between checking our wait_list position and setting the task state for
long enough that two other tasks can conspire against us in the meantime
(and one of them must have received a signal).

Patch #5 is also new; it gets rid of the static inline ww_mutex_lock
wrappers.

Patch #6 (the heart of the series): Changed to be much less invasive to the
trylock calls. I've also changed the __ww_mutex_add_waiter loop to scan the
wait list in reverse order. It's probably a wash overall.

I kept the logic as far as setting ww_ctx in mutex_waiter is concerned.

About the changes to optimistic spin: I've moved them towards the end so
that they're easy to take or leave. They didn't change much in my
measurements, so I'm not very attached to them, but they do seem more
"right" to me for the w/w case.

Is there a verdict on the whole "use_ww_ctx doesn't work for
mutex_spin_on_owner" question?

Thanks,
Nicolai

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2017-01-05 17:48 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-21 18:46 [PATCH v3 00/12] locking/ww_mutex: Keep sorted wait list to avoid stampedes Nicolai Hähnle
2016-12-21 18:46 ` [PATCH v3 01/12] drm/vgem: Use ww_mutex_(un)lock even with a NULL context Nicolai Hähnle
2016-12-21 18:46   ` Nicolai Hähnle
2016-12-21 18:46 ` [PATCH v3 02/12] locking/mutex: Fix a race with handoffs and interruptible waits Nicolai Hähnle
2016-12-21 18:46 ` [PATCH v3 03/12] locking/ww_mutex: Extract stamp comparison to __ww_mutex_stamp_after Nicolai Hähnle
2016-12-21 18:46   ` Nicolai Hähnle
2016-12-22  1:58   ` zhoucm1
2016-12-22  1:58     ` zhoucm1
2016-12-22  8:43     ` Nicolai Hähnle
2016-12-22  8:43       ` Nicolai Hähnle
2016-12-21 18:46 ` [PATCH v3 04/12] locking/ww_mutex: Set use_ww_ctx even when locking without a context Nicolai Hähnle
2016-12-21 18:46   ` Nicolai Hähnle
2016-12-21 18:46 ` [PATCH v3 05/12] locking/ww_mutex: Remove the __ww_mutex_lock inline wrappers Nicolai Hähnle
2016-12-23 10:48   ` Peter Zijlstra
2016-12-23 10:48     ` Peter Zijlstra
2016-12-23 11:16     ` Nicolai Hähnle
2016-12-23 12:13       ` Peter Zijlstra
2016-12-23 12:13         ` Peter Zijlstra
2016-12-21 18:46 ` [PATCH v3 06/12] locking/ww_mutex: Add waiters in stamp order Nicolai Hähnle
2016-12-21 18:46   ` Nicolai Hähnle
2016-12-21 18:46 ` [PATCH v3 07/12] locking/ww_mutex: Notify waiters that have to back off while adding tasks to wait list Nicolai Hähnle
2016-12-21 18:46 ` [PATCH v3 08/12] locking/ww_mutex: Wake at most one waiter for back off when acquiring the lock Nicolai Hähnle
2016-12-21 18:46 ` [PATCH v3 09/12] locking/ww_mutex: Re-check ww->ctx in the inner optimistic spin loop Nicolai Hähnle
2016-12-21 18:46 ` [PATCH v3 10/12] locking/ww_mutex: Yield to other waiters from optimistic spin Nicolai Hähnle
2016-12-21 18:46   ` Nicolai Hähnle
2017-01-05 17:47   ` Peter Zijlstra
2017-01-05 17:47     ` Peter Zijlstra
2016-12-21 18:46 ` [PATCH v3 11/12] locking/mutex: Initialize mutex_waiter::ww_ctx with poison when debugging Nicolai Hähnle
2016-12-21 18:46 ` [PATCH v3 12/12] Documentation/locking/ww_mutex: Update the design document Nicolai Hähnle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.