Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1460144
| From | Jason Low <jason.low2@hpe.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled |
| Date | 2016-08-11 04:40 +0200 |
| Message-ID | <s4O4x-5g3-5@gated-at.bofh.it> (permalink) |
| References | <s4GJI-j6-57@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, 2016-08-10 at 11:44 -0700, Jason Low wrote:
> @@ -917,11 +976,12 @@ EXPORT_SYMBOL(mutex_trylock);
> int __sched
> __ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
> {
> - int ret;
> + int ret = 1;
>
> might_sleep();
>
> - ret = __mutex_fastpath_lock_retval(&lock->base.count);
> + if (!need_yield_to_waiter(lock))
> + ret = __mutex_fastpath_lock_retval(&lock->base.count);
>
> if (likely(!ret)) {
> ww_mutex_set_context_fastpath(lock, ctx);
> @@ -935,11 +995,12 @@ EXPORT_SYMBOL(__ww_mutex_lock);
> int __sched
> __ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
> {
> - int ret;
> + int ret = 1;
>
> might_sleep();
>
> - ret = __mutex_fastpath_lock_retval(&lock->base.count);
> + if (!need_yield_to_waiter(lock))
And we would need to pass &lock->base instead of lock since lock is
struct ww_mutex * here.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled Jason Low <jason.low2@hpe.com> - 2016-08-10 20:50 +0200
Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled Jason Low <jason.low2@hpe.com> - 2016-08-11 00:10 +0200
Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled Jason Low <jason.low2@hpe.com> - 2016-08-11 04:40 +0200
Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled Jason Low <jason.low2@hpe.com> - 2016-08-16 21:50 +0200
Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled Wanpeng Li <kernellwp@gmail.com> - 2016-08-17 03:50 +0200
Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled Jason Low <jason.low2@hpe.com> - 2016-08-17 20:40 +0200
Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled Wanpeng Li <kernellwp@gmail.com> - 2016-08-18 02:40 +0200
Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled Peter Zijlstra <peterz@infradead.org> - 2016-08-18 16:30 +0200
Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled Peter Zijlstra <peterz@infradead.org> - 2016-08-19 02:50 +0200
Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled Peter Zijlstra <peterz@infradead.org> - 2016-08-19 02:50 +0200
Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled Peter Zijlstra <peterz@infradead.org> - 2016-08-18 16:50 +0200
csiph-web