From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: peterz@infradead.org, tglx@kernel.org, mingo@redhat.com,
linux-kernel@vger.kernel.org, will@kernel.org, boqun@kernel.org,
longman@redhat.com, rostedt@goodmis.org, clrkwllms@kernel.org,
dvhart@infradead.org, dave@stgolabs.net, andrealmeid@igalia.com,
shuah@kernel.org, juri.lelli@redhat.com,
linux-rt-devel@lists.linux.dev, linux-kselftest@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2 1/5] locking/rtmutex: Stop spinning on the owner when the waiter is woken
Date: Mon, 16 Nov 2026 13:06:26 +0100 [thread overview]
Message-ID: <20261116120626.JVHxeSTu@linutronix.de> (raw)
In-Reply-To: <20261108141347.1525532-2-mathieu.desnoyers@efficios.com>
On 2026-11-08 09:13:43 [-0500], Mathieu Desnoyers wrote:
> Fixes: 992caf7f1724 ("locking/rtmutex: Add adaptive spinwait mechanism")
> Cc: stable@vger.kernel.org
> Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> ---
> kernel/locking/rtmutex.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
> index 5a9534c715b8..323973be2074 100644
> --- a/kernel/locking/rtmutex.c
> +++ b/kernel/locking/rtmutex.c
> @@ -1516,9 +1516,13 @@ static bool rtmutex_spin_on_owner(struct rt_mutex_base *lock,
> * - current is not longer the top waiter
> * - current is requested to reschedule (redundant
> * for CONFIG_PREEMPT_RCU=y)
> + * - current is woken, by its timeout, a signal or
> + * whatever else would end the sleep the spin
> + * stands in for
> * - the VCPU on which owner runs is preempted
> */
> if (!owner_on_cpu(owner) || need_resched() ||
> + task_is_running(current) ||
Wouldn't it make sense to return true in this case so it can re-evaluate
the situation for timeout/ signal rather than visit the scheduler for no
reason?
Also, wouldn't it make sense to restrict this to
rt_mutex_slowlock_block() (and maybe there to the !TASK_UNINTERRUPTIBLE
case but this might result in too much code) rather than have it also
available rtlock_slowlock_locked() where it makes no difference?
That file is included so having rtlock_slowlock_locked() pass an
argument would remove that branch from code generation.
> !data_race(rt_mutex_waiter_is_top_waiter(lock, waiter))) {
> res = false;
> break;
Sebastian
next prev parent reply other threads:[~2026-11-16 12:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 14:13 [PATCH v2 0/5] locking/rtmutex: priority inheritance fixes and tests Mathieu Desnoyers
2026-11-08 14:13 ` [PATCH v2 1/5] locking/rtmutex: Stop spinning on the owner when the waiter is woken Mathieu Desnoyers
2026-11-16 12:06 ` Sebastian Andrzej Siewior [this message]
2026-11-08 14:13 ` [PATCH v2 2/5] locking/rtmutex: Initialize the ww_mutex context of a waiter Mathieu Desnoyers
2026-11-08 14:13 ` [PATCH v2 3/5] locking/rtmutex: Clone the sort keys in rt_mutex_enqueue_pi() Mathieu Desnoyers
2026-11-08 14:13 ` [PATCH v2 4/5] selftests/futex: Test priority inheritance on PI futexes Mathieu Desnoyers
2026-11-08 14:13 ` [PATCH v2 5/5] locking/ww_mutex/test: Time an ABBA with both owners running Mathieu Desnoyers
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=20261116120626.JVHxeSTu@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=andrealmeid@igalia.com \
--cc=boqun@kernel.org \
--cc=clrkwllms@kernel.org \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=longman@redhat.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=shuah@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tglx@kernel.org \
--cc=will@kernel.org \
/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
all inboxes | Powered by JetHome®