Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1528493
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/4] locking/ww_mutex: Fix a deadlock affecting ww_mutexes |
| Date | 2016-11-23 16:20 +0100 |
| Message-ID | <sGGSm-65N-35@gated-at.bofh.it> (permalink) |
| References | <sGDUt-4co-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Nov 23, 2016 at 12:25:22PM +0100, Nicolai Hähnle wrote: > @@ -473,7 +476,14 @@ void __sched ww_mutex_unlock(struct ww_mutex *lock) > */ > mutex_clear_owner(&lock->base); > #endif > - __mutex_fastpath_unlock(&lock->base.count, __mutex_unlock_slowpath); > + /* > + * A previously _not_ waiting task may acquire the lock via the fast > + * path during our unlock. In that case, already waiting tasks may have > + * to back off to avoid a deadlock. Wake up all waiters so that they > + * can check their acquire context stamp against the new owner. > + */ > + __mutex_fastpath_unlock(&lock->base.count, > + __mutex_unlock_slowpath_wakeall); > } So doing a wake-all has obvious issues with thundering herd etc.. Also, with the new mutex, you'd not be able to do hand-off, which would introduce starvation cases. Ideally we'd iterate the blocked list and pick the waiter with the earliest stamp, or we'd maintain the list in stamp order instead of FIFO, for ww_mutex.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 1/4] locking/ww_mutex: Fix a deadlock affecting ww_mutexes Nicolai Hähnle <nhaehnle@gmail.com> - 2016-11-23 12:30 +0100
Re: [PATCH 1/4] locking/ww_mutex: Fix a deadlock affecting ww_mutexes Daniel Vetter <daniel@ffwll.ch> - 2016-11-23 14:00 +0100
Re: [PATCH 1/4] locking/ww_mutex: Fix a deadlock affecting ww_mutexes Daniel Vetter <daniel@ffwll.ch> - 2016-11-23 14:10 +0100
Re: [PATCH 1/4] locking/ww_mutex: Fix a deadlock affecting ww_mutexes Daniel Vetter <daniel@ffwll.ch> - 2016-11-23 14:20 +0100
Re: [PATCH 1/4] locking/ww_mutex: Fix a deadlock affecting ww_mutexes Maarten Lankhorst <dev@mblankhorst.nl> - 2016-11-23 14:50 +0100
Re: [PATCH 1/4] locking/ww_mutex: Fix a deadlock affecting ww_mutexes Peter Zijlstra <peterz@infradead.org> - 2016-11-23 14:10 +0100
Re: [PATCH 1/4] locking/ww_mutex: Fix a deadlock affecting ww_mutexes Peter Zijlstra <peterz@infradead.org> - 2016-11-23 15:40 +0100
Re: [PATCH 1/4] locking/ww_mutex: Fix a deadlock affecting ww_mutexes Daniel Vetter <daniel@ffwll.ch> - 2016-11-23 16:10 +0100
Re: [PATCH 1/4] locking/ww_mutex: Fix a deadlock affecting ww_mutexes Nicolai Hähnle <nhaehnle@gmail.com> - 2016-11-24 12:30 +0100
Re: [PATCH 1/4] locking/ww_mutex: Fix a deadlock affecting ww_mutexes Peter Zijlstra <peterz@infradead.org> - 2016-11-24 12:50 +0100
Re: [PATCH 1/4] locking/ww_mutex: Fix a deadlock affecting ww_mutexes Daniel Vetter <daniel@ffwll.ch> - 2016-11-24 13:00 +0100
Re: [PATCH 1/4] locking/ww_mutex: Fix a deadlock affecting ww_mutexes Peter Zijlstra <peterz@infradead.org> - 2016-11-24 13:20 +0100
Re: [PATCH 1/4] locking/ww_mutex: Fix a deadlock affecting ww_mutexes Peter Zijlstra <peterz@infradead.org> - 2016-11-23 16:20 +0100
csiph-web