From: David Laight <David.Laight@ACULAB.COM>
To: 'Steven Rostedt' <rostedt@goodmis.org>, John Stultz <jstultz@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Wei Wang <wvw@google.com>,
"Midas Chien" <midaschieh@google.com>,
Kees Cook <keescook@chromium.org>,
"Anton Vorontsov" <anton@enomsg.org>,
"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
Tony Luck <tony.luck@intel.com>,
"kernel-team@android.com" <kernel-team@android.com>,
Thomas Gleixner <tglx@linutronix.de>,
"Peter Zijlstra" <peterz@infradead.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: RE: [PATCH] pstore: Revert pmsg_lock back to a normal mutex
Date: Thu, 2 Mar 2023 22:41:36 +0000 [thread overview]
Message-ID: <dcf2fa0bde1e49a286c57c1e7d4a78d3@AcuMS.aculab.com> (raw)
In-Reply-To: <20230302152103.2618f1b7@gandalf.local.home>
From: Steven Rostedt
> Sent: 02 March 2023 20:21
...
> There's no harm in spinning, as the task can still be preempted, and
> there's no issue of priority inversion, because the spinners will not be on
> the same CPU as the owner and the top waiter, if they only spin if those
> two tasks are also running on a CPU.
ISTM that a spinlock should spin - even on an RT kernel.
If it might spin for longer than it takes to do a process
switch it shouldn't be a spinlock at all.
(I bet there are quite a few that do spin for ages...)
Adaptive spinning for a sleep lock (as an optimisation)
is entirely different.
I changed some very old driver code that used sema4 (which
always sleep) to mutex (which quite often spin) and got a
massive performance gain.
I've also had terrible problems trying to get a multithreaded
user program to work well [1].
Because you don't have spinlocks (userpace can always be preempted)
you can't bound the time mutex are held for.
So any vaguely 'hot' lock (maybe just used to remove an item
from a list) can get interrupted by a hardware interrupt.
The only way to make it work is to use atomic operations
instead of mutex.
I can't help feeing that the RT kernel suffers from the
same problems if the system is under any kind of load.
You might get slightly better RT response, but the overall
amount of 'work' a system can actually do will be lower.
[1] Test was 36 threads on a 40 cpu system that need to
spend about 90% of the time processing RTP (UDP) audio.
This also involves 500k ethernet packets/sec (tx and rx).
It is all possible, but there were a lot of pitfalls.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2023-03-02 22:41 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 6:27 John Stultz
2023-03-02 13:24 ` Steven Rostedt
2023-03-02 19:39 ` John Stultz
2023-03-02 20:21 ` Steven Rostedt
2023-03-02 21:32 ` Steven Rostedt
2023-03-02 21:36 ` Steven Rostedt
2023-03-02 21:56 ` Steven Rostedt
2023-03-03 1:01 ` Steven Rostedt
2023-03-03 18:11 ` Joel Fernandes
2023-03-03 18:37 ` Steven Rostedt
2023-03-03 19:25 ` Joel Fernandes
2023-03-03 19:38 ` Steven Rostedt
2023-03-03 20:36 ` Qais Yousef
2023-03-04 3:21 ` Joel Fernandes
2023-03-06 19:19 ` Qais Yousef
2023-03-04 3:01 ` Joel Fernandes
2023-03-04 3:23 ` Joel Fernandes
2023-03-07 14:08 ` Peter Zijlstra
2023-03-07 20:19 ` Joel Fernandes
2023-03-06 18:30 ` John Stultz
2023-03-08 1:31 ` Steven Rostedt
2023-03-08 20:04 ` John Stultz
2023-03-08 20:41 ` Steven Rostedt
2023-03-02 22:41 ` David Laight [this message]
2023-03-02 22:53 ` Steven Rostedt
2023-03-04 3:10 ` [PATCH v2] " John Stultz
2023-03-05 16:36 ` Steven Rostedt
2023-03-06 18:27 ` John Stultz
[not found] ` <20230306010323.2909-1-hdanton@sina.com>
2023-03-06 15:28 ` Steven Rostedt
[not found] ` <20230307003106.1768-1-hdanton@sina.com>
2023-03-07 1:58 ` Steven Rostedt
2023-03-03 7:06 [PATCH] " Chunhui Li (李春辉)
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=dcf2fa0bde1e49a286c57c1e7d4a78d3@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=anton@enomsg.org \
--cc=bigeasy@linutronix.de \
--cc=gpiccoli@igalia.com \
--cc=jstultz@google.com \
--cc=keescook@chromium.org \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=midaschieh@google.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=wvw@google.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