linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2] pstore: Revert pmsg_lock back to a normal mutex
       [not found]   ` <20230305113632.26de0a4d@gandalf.local.home>
@ 2023-03-06  1:03     ` Hillf Danton
  2023-03-06 15:28       ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Hillf Danton @ 2023-03-06  1:03 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: John Stultz, LKML, Wei Wang, Midas Chien,
	Chunhui Li (李春辉),
	Kees Cook, Anton Vorontsov, Guilherme G. Piccoli, Tony Luck,
	linux-mm

On Sun, 5 Mar 2023 11:36:32 -0500 Steven Rostedt <rostedt@goodmis.org>
> On Sat, 4 Mar 2023 03:10:29 +0000 John Stultz <jstultz@google.com> wrote:
> 
> > This reverts commit 76d62f24db07f22ccf9bc18ca793c27d4ebef721.
> > 
> > So while priority inversion on the pmsg_lock is an occasional
> > problem that an rt_mutex would help with, in uses where logging
> > is writing to pmsg heavily from multiple threads, the pmsg_lock
> > can be heavily contended.
> > 
> > Normal mutexes can do adaptive spinning, which keeps the
> > contention overhead fairly low maybe adding on the order of 10s
> > of us delay waiting, but the slowpath w/ rt_mutexes makes the
> > blocked tasks sleep & wake. This makes matters worse when there
> > is heavy contentention, as it just allows additional threads to
> > run and line up to try to take the lock.
> 
> That is incorrect. rt_mutexes have pretty much the same adaptive spinning
> as normal mutexes. So that is *not* the reason for the difference in
> performance, and should not be stated so in this change log.
> 
> The difference between rt_mutex and normal mutex, is that the rt_mutex will
> trigger priority inheritance. Perhaps on high contention, that makes a
> difference. But do not state it's because rt_mutex does not have adaptive
> spinning, because it most definitely does.

Another difference between rt_mutex and mutex is that mutex has another
optimistic spin with the first waiter ignored, and that can be tested by
simply skipping it. Perhaps because of the fact that it makes no sense for
other waiters than the first one to spin on owner in rt context.

PS what sense made by spinning on owner until need_resched() with preempt
disabled in the non-rt context?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] pstore: Revert pmsg_lock back to a normal mutex
  2023-03-06  1:03     ` [PATCH v2] pstore: Revert pmsg_lock back to a normal mutex Hillf Danton
@ 2023-03-06 15:28       ` Steven Rostedt
  2023-03-07  0:31         ` Hillf Danton
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2023-03-06 15:28 UTC (permalink / raw)
  To: Hillf Danton
  Cc: John Stultz, LKML, Wei Wang, Midas Chien,
	Chunhui Li (李春辉),
	Kees Cook, Anton Vorontsov, Guilherme G. Piccoli, Tony Luck,
	linux-mm

On Mon,  6 Mar 2023 09:03:23 +0800
Hillf Danton <hdanton@sina.com> wrote:

> PS what sense made by spinning on owner until need_resched() with preempt
> disabled in the non-rt context?

Not sure what the question you have here is? If need_resched() is set, we
want to schedule out.

-- Steve


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] pstore: Revert pmsg_lock back to a normal mutex
  2023-03-06 15:28       ` Steven Rostedt
@ 2023-03-07  0:31         ` Hillf Danton
  2023-03-07  1:58           ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Hillf Danton @ 2023-03-07  0:31 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: John Stultz, LKML, Wei Wang, Midas Chien,
	Chunhui Li (李春辉),
	Kees Cook, Anton Vorontsov, Guilherme G. Piccoli, Tony Luck,
	linux-mm

On Mon, 6 Mar 2023 10:28:44 -0500 Steven Rostedt <rostedt@goodmis.org>
> On Mon, 6 Mar 2023 09:03:23 +0800 Hillf Danton <hdanton@sina.com> wrote:
> >
> > PS what sense made by spinning on owner until need_resched() with preempt
> > disabled in the non-rt context?
> 
> Not sure what the question you have here is? If need_resched() is set, we
> want to schedule out.

Given the critical section under mutex could be preempted, what is hard to
understand is the wakeup of a ten-minute sleeper could not preempt a nice-10
mutex spinner for instance.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] pstore: Revert pmsg_lock back to a normal mutex
  2023-03-07  0:31         ` Hillf Danton
@ 2023-03-07  1:58           ` Steven Rostedt
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2023-03-07  1:58 UTC (permalink / raw)
  To: Hillf Danton
  Cc: John Stultz, LKML, Wei Wang, Midas Chien,
	Chunhui Li (李春辉),
	Kees Cook, Anton Vorontsov, Guilherme G. Piccoli, Tony Luck,
	linux-mm

On Tue,  7 Mar 2023 08:31:06 +0800
Hillf Danton <hdanton@sina.com> wrote:

> On Mon, 6 Mar 2023 10:28:44 -0500 Steven Rostedt <rostedt@goodmis.org>
> > On Mon, 6 Mar 2023 09:03:23 +0800 Hillf Danton <hdanton@sina.com> wrote:  
> > >
> > > PS what sense made by spinning on owner until need_resched() with preempt
> > > disabled in the non-rt context?  
> > 
> > Not sure what the question you have here is? If need_resched() is set, we
> > want to schedule out.  
> 
> Given the critical section under mutex could be preempted, what is hard to
> understand is the wakeup of a ten-minute sleeper could not preempt a nice-10
> mutex spinner for instance.

But it can. Most wakeups are done by interrupts or softirqs. Both of which
will happen even if a task is running with preemption disabled.

-- Steve


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-07  1:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230302062741.483079-1-jstultz@google.com>
     [not found] ` <20230304031029.3037914-1-jstultz@google.com>
     [not found]   ` <20230305113632.26de0a4d@gandalf.local.home>
2023-03-06  1:03     ` [PATCH v2] pstore: Revert pmsg_lock back to a normal mutex Hillf Danton
2023-03-06 15:28       ` Steven Rostedt
2023-03-07  0:31         ` Hillf Danton
2023-03-07  1:58           ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox