From: Peter Zijlstra <peterz@infradead.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
Maarten Lankhorst <maarten.lankhorst@canonical.com>,
Mike Galbraith <umgwanakikbuti@gmail.com>
Subject: Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock
Date: Tue, 10 Mar 2015 13:30:57 +0100 [thread overview]
Message-ID: <20150310123057.GZ2896@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <1425056229-22326-3-git-send-email-bigeasy@linutronix.de>
On Fri, Feb 27, 2015 at 05:57:08PM +0100, Sebastian Andrzej Siewior wrote:
> diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
> index 16b2d3cc88b0..0a652ba46081 100644
> --- a/kernel/locking/mutex.c
> +++ b/kernel/locking/mutex.c
> @@ -106,6 +106,7 @@ void __sched mutex_lock(struct mutex *lock)
> EXPORT_SYMBOL(mutex_lock);
> #endif
>
> +#ifndef CONFIG_WW_MUTEX_RTMUTEX
> static __always_inline void ww_mutex_lock_acquired(struct ww_mutex *ww,
> struct ww_acquire_ctx *ww_ctx)
> {
> @@ -215,6 +216,7 @@ ww_mutex_set_context_slowpath(struct ww_mutex *lock,
> wake_up_process(cur->task);
> }
> }
> +#endif
Should we shuffle the code a bit to collect all the ww_mutex functions
in one #ifdef block?
> #ifdef CONFIG_MUTEX_SPIN_ON_OWNER
> /*
> @@ -328,6 +330,7 @@ static bool mutex_optimistic_spin(struct mutex *lock,
> while (true) {
> struct task_struct *owner;
>
> +#ifndef CONFIG_WW_MUTEX_RTMUTEX
> if (use_ww_ctx && ww_ctx->acquired > 0) {
> struct ww_mutex *ww;
>
> @@ -343,7 +346,7 @@ static bool mutex_optimistic_spin(struct mutex *lock,
> if (READ_ONCE(ww->ctx))
> break;
> }
> -
> +#endif
> /*
> * If there's an owner, wait for it to either
> * release the lock or go to sleep.
> @@ -356,12 +359,14 @@ static bool mutex_optimistic_spin(struct mutex *lock,
> if (mutex_try_to_acquire(lock)) {
> lock_acquired(&lock->dep_map, ip);
>
> +#ifndef CONFIG_WW_MUTEX_RTMUTEX
> if (use_ww_ctx) {
> struct ww_mutex *ww;
> ww = container_of(lock, struct ww_mutex, base);
>
> ww_mutex_set_context_fastpath(ww, ww_ctx);
> }
> +#endif
>
> mutex_set_owner(lock);
> osq_unlock(&lock->osq);
> @@ -445,6 +450,7 @@ void __sched mutex_unlock(struct mutex *lock)
>
> EXPORT_SYMBOL(mutex_unlock);
Are those ifdefs really needed, if we provide stubs and ensure to only
call mutex_optimistic_spin/__mutex_lock_common with .ww_ctx=NULL,
.use_ww_ctx = false, this should all just go away without #ifdefs,
right?
next prev parent reply other threads:[~2015-03-10 12:31 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-27 16:57 rt_mutex based ww_mutex implementation Sebastian Andrzej Siewior
2015-02-27 16:57 ` [PATCH 1/3] locking: ww_mutex: add one level of indirection for access of the lock Sebastian Andrzej Siewior
2015-02-27 18:20 ` Maarten Lankhorst
2015-02-27 18:57 ` Sebastian Andrzej Siewior
2015-02-27 16:57 ` [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock Sebastian Andrzej Siewior
2015-03-02 3:20 ` Mike Galbraith
2015-03-02 8:46 ` Maarten Lankhorst
2015-03-02 12:50 ` Mike Galbraith
2015-03-06 12:14 ` Sebastian Andrzej Siewior
2015-03-06 12:16 ` Maarten Lankhorst
2015-03-06 12:36 ` Sebastian Andrzej Siewior
2015-03-06 17:50 ` Mike Galbraith
2015-03-09 10:00 ` Sebastian Andrzej Siewior
2015-03-09 10:51 ` Mike Galbraith
2015-03-09 11:07 ` Sebastian Andrzej Siewior
2015-03-09 11:29 ` Mike Galbraith
2015-03-09 13:21 ` Sebastian Andrzej Siewior
2015-03-09 22:27 ` Paul E. McKenney
2015-03-10 12:30 ` Peter Zijlstra [this message]
2015-03-10 12:37 ` Peter Zijlstra
2015-03-10 12:39 ` Peter Zijlstra
2015-03-10 14:10 ` Maarten Lankhorst
2015-03-10 15:28 ` Peter Zijlstra
2015-03-10 18:21 ` Maarten Lankhorst
2015-03-10 12:43 ` Peter Zijlstra
2015-03-10 12:46 ` Peter Zijlstra
2015-02-27 16:57 ` [PATCH 3/3] locking: rtmutex: set state back to running on error Sebastian Andrzej Siewior
2015-02-28 10:00 ` [tip:locking/urgent] locking/rtmutex: Set " tip-bot for Sebastian Andrzej Siewior
2015-03-01 5:35 ` [PATCH 3/3] locking: rtmutex: set " Mike Galbraith
2015-03-01 8:48 ` [tip:locking/urgent] locking/rtmutex: Set " tip-bot for Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150310123057.GZ2896@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@canonical.com \
--cc=mingo@redhat.com \
--cc=umgwanakikbuti@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome