public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Regression in SYS_membarrier expedited
@ 2019-02-17 18:48 Rich Felker
  2019-02-17 21:34 ` Mathieu Desnoyers
  0 siblings, 1 reply; 8+ messages in thread
From: Rich Felker @ 2019-02-17 18:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mathieu Desnoyers, Paul E. McKenney, Peter Zijlstra, Ingo Molnar,
	Alexander Viro

commit a961e40917fb14614d368d8bc9782ca4d6a8cd11 made it so that the
MEMBARRIER_CMD_PRIVATE_EXPEDITED command cannot be used without first
registering intent to use it. However, registration is an expensive
operation since commit 3ccfebedd8cf54e291c809c838d8ad5cc00f5688, which
added synchronize_sched() to it; this means it's no longer possible to
lazily register intent at first use, and it's unreasonably expensive
to preemptively register intent for possibly extremely-short-lived
processes that will never use it. (My usage case is in libc (musl),
where I can't know if the process will be short- or long-lived;
unnecessary and potentially expensive syscalls can't be made
preemptively, only lazily at first use.)

Can we restore the functionality of MEMBARRIER_CMD_PRIVATE_EXPEDITED
to work even without registration? The motivation of requiring
registration seems to be:

    "Registering at this time removes the need to interrupt each and
    every thread in that process at the first expedited
    sys_membarrier() system call."

but interrupting every thread in the process is exactly what I expect,
and is not a problem. What does seem like a big problem is waiting for
synchronize_sched() to synchronize with an unboundedly large number of
cores (vs only a few threads in the process), especially in the
presence of full_nohz, where it seems like latency would be at least a
few ms and possibly unbounded.

Short of a working SYS_membarrier that doesn't require expensive
pre-registration, I'm stuck just implementing it in userspace with
signals...

Rich

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

end of thread, other threads:[~2019-02-19 16:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-17 18:48 Regression in SYS_membarrier expedited Rich Felker
2019-02-17 21:34 ` Mathieu Desnoyers
2019-02-17 21:52   ` Rich Felker
2019-02-17 22:08     ` Rich Felker
2019-02-18 15:22       ` Mathieu Desnoyers
2019-02-18 21:55         ` Rich Felker
2019-02-19 16:02           ` Mathieu Desnoyers
2019-02-19 16:36             ` Rich Felker

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