From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Lai Jiangshan <jiangshanlai@gmail.com>,
dipankar <dipankar@in.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Josh Triplett <josh@joshtriplett.org>,
Thomas Gleixner <tglx@linutronix.de>,
rostedt <rostedt@goodmis.org>,
David Howells <dhowells@redhat.com>,
Eric Dumazet <edumazet@google.com>, fweisbec <fweisbec@gmail.com>,
Oleg Nesterov <oleg@redhat.com>,
Will Deacon <will.deacon@arm.com>
Subject: Re: [PATCH tip/core/rcu 4/5] sys_membarrier: Add expedited option
Date: Thu, 27 Jul 2017 07:44:39 -0700 [thread overview]
Message-ID: <20170727144439.GX3730@linux.vnet.ibm.com> (raw)
In-Reply-To: <1441520000.28295.1501159176561.JavaMail.zimbra@efficios.com>
On Thu, Jul 27, 2017 at 12:39:36PM +0000, Mathieu Desnoyers wrote:
> ----- On Jul 26, 2017, at 9:45 PM, Paul E. McKenney paulmck@linux.vnet.ibm.com wrote:
>
> > On Wed, Jul 26, 2017 at 02:11:46PM -0700, Paul E. McKenney wrote:
> >> On Wed, Jul 26, 2017 at 08:37:23PM +0000, Mathieu Desnoyers wrote:
> >> > ----- On Jul 26, 2017, at 2:30 PM, Paul E. McKenney paulmck@linux.vnet.ibm.com
> >> > wrote:
> >> >
> >> > > On Wed, Jul 26, 2017 at 06:01:15PM +0000, Mathieu Desnoyers wrote:
> >> > >> ----- On Jul 26, 2017, at 11:42 AM, Paul E. McKenney paulmck@linux.vnet.ibm.com
> >> > >> wrote:
> >> > >>
> >> > >> > On Wed, Jul 26, 2017 at 09:46:56AM +0200, Peter Zijlstra wrote:
> >> > >> >> On Tue, Jul 25, 2017 at 10:50:13PM +0000, Mathieu Desnoyers wrote:
> >> > >> >> > This would implement a MEMBARRIER_CMD_PRIVATE_EXPEDITED (or such) flag
> >> > >> >> > for expedited process-local effect. This differs from the "SHARED" flag,
> >> > >> >> > since the SHARED flag affects threads accessing memory mappings shared
> >> > >> >> > across processes as well.
> >> > >> >> >
> >> > >> >> > I wonder if we could create a MEMBARRIER_CMD_SHARED_EXPEDITED behavior
> >> > >> >> > by iterating on all memory mappings mapped into the current process,
> >> > >> >> > and build a cpumask based on the union of all mm masks encountered ?
> >> > >> >> > Then we could send the IPI to all cpus belonging to that cpumask. Or
> >> > >> >> > am I missing something obvious ?
> >> > >> >>
> >> > >> >> I would readily object to such a beast. You far too quickly end up
> >> > >> >> having to IPI everybody because of some stupid shared map or something
> >> > >> >> (yes I know, normal DSOs are mapped private).
> >> > >> >
> >> > >> > Agreed, we should keep things simple to start with. The user can always
> >> > >> > invoke sys_membarrier() from each process.
> >> > >>
> >> > >> Another alternative for a MEMBARRIER_CMD_SHARED_EXPEDITED would be rate-limiting
> >> > >> per thread. For instance, we could add a new "ulimit" that would bound the
> >> > >> number of expedited membarrier per thread that can be done per millisecond,
> >> > >> and switch to synchronize_sched() whenever a thread goes beyond that limit
> >> > >> for the rest of the time-slot.
> >> > >>
> >> > >> A RT system that really cares about not having userspace sending IPIs
> >> > >> to all cpus could set the ulimit value to 0, which would always use
> >> > >> synchronize_sched().
> >> > >>
> >> > >> Thoughts ?
> >> > >
> >> > > The patch I posted reverts to synchronize_sched() in kernels booted with
> >> > > rcupdate.rcu_normal=1. ;-)
> >> > >
> >> > > But who is pushing for multiple-process sys_membarrier()? Everyone I
> >> > > have talked to is OK with it being local to the current process.
> >> >
> >> > I guess I'm probably the guilty one intending to do weird stuff in userspace ;)
> >> >
> >> > Here are my two use-cases:
> >> >
> >> > * a new multi-process liburcu flavor, useful if e.g. a set of processes are
> >> > responsible for updating a shared memory data structure, and a separate set
> >> > of processes read that data structure. The readers can be killed without ill
> >> > effect on the other processes. The synchronization could be done by one
> >> > multi-process liburcu flavor per reader process "group".
> >> >
> >> > * lttng-ust user-space ring buffers (shared across processes).
> >> >
> >> > Both rely on a shared memory mapping for communication between processes, and
> >> > I would like to be able to issue a sys_membarrier targeting all CPUs that may
> >> > currently touch the shared memory mapping.
> >> >
> >> > I don't really need a system-wide effect, but I would like to be able to target
> >> > a shared memory mapping and efficiently do an expedited sys_membarrier on all
> >> > cpus involved.
> >> >
> >> > With lttng-ust, the shared buffers can spawn across 1000+ processes, so
> >> > asking each process to issue sys_membarrier would add lots of unneeded overhead,
> >> > because this would issue lots of needless memory barriers.
> >> >
> >> > Thoughts ?
> >>
> >> Dealing explicitly with 1000+ processes sounds like no picnic. It instead
> >> sounds like a job for synchronize_sched_expedited(). ;-)
> >
> > Actually...
> >
> > Mathieu, does your use case require unprivileged access to sys_membarrier()?
>
> Unfortunately, yes, it does require sys_membarrier to be used from non-root
> both for lttng-ust and liburcu multi-process. And as Peter pointed out, stuff
> like containers complicates things even for the root case.
Hey, I was hoping! ;-)
Thanx, Paul
next prev parent reply other threads:[~2017-07-27 14:44 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-24 21:57 [PATCH tip/core/rcu 0/5] Related non-RCU updates Paul E. McKenney
2017-07-24 21:58 ` [PATCH tip/core/rcu 1/5] module: Fix pr_fmt() bug for header use of printk Paul E. McKenney
2017-07-24 21:58 ` [PATCH tip/core/rcu 2/5] init_task: Remove redundant INIT_TASK_RCU_TREE_PREEMPT() macro Paul E. McKenney
2017-07-24 21:58 ` [PATCH tip/core/rcu 3/5] EXPERIMENTAL sched: Allow migrating kthreads into online but inactive CPUs Paul E. McKenney
2017-07-24 21:58 ` [PATCH tip/core/rcu 4/5] sys_membarrier: Add expedited option Paul E. McKenney
2017-07-25 4:27 ` Boqun Feng
2017-07-25 16:24 ` Paul E. McKenney
2017-07-25 13:21 ` Mathieu Desnoyers
2017-07-25 16:48 ` Paul E. McKenney
2017-07-25 16:33 ` Peter Zijlstra
2017-07-25 16:49 ` Paul E. McKenney
2017-07-25 16:59 ` Peter Zijlstra
2017-07-25 17:17 ` Paul E. McKenney
2017-07-25 18:53 ` Peter Zijlstra
2017-07-25 19:36 ` Paul E. McKenney
2017-07-25 20:24 ` Peter Zijlstra
2017-07-25 21:19 ` Paul E. McKenney
2017-07-25 21:55 ` Peter Zijlstra
2017-07-25 22:39 ` Mathieu Desnoyers
2017-07-25 22:50 ` Mathieu Desnoyers
2017-07-26 0:01 ` Paul E. McKenney
2017-07-26 7:46 ` Peter Zijlstra
2017-07-26 15:42 ` Paul E. McKenney
2017-07-26 18:01 ` Mathieu Desnoyers
2017-07-26 18:30 ` Paul E. McKenney
2017-07-26 20:37 ` Mathieu Desnoyers
2017-07-26 21:11 ` Paul E. McKenney
2017-07-27 1:45 ` Paul E. McKenney
2017-07-27 12:39 ` Mathieu Desnoyers
2017-07-27 14:44 ` Paul E. McKenney [this message]
2017-07-27 10:24 ` Peter Zijlstra
2017-07-27 14:52 ` Paul E. McKenney
2017-07-27 8:53 ` Peter Zijlstra
2017-07-27 10:09 ` Peter Zijlstra
2017-07-27 10:22 ` Will Deacon
2017-07-27 13:14 ` Paul E. McKenney
2017-07-25 23:59 ` Paul E. McKenney
2017-07-26 7:41 ` Peter Zijlstra
2017-07-26 15:41 ` Paul E. McKenney
2017-07-27 8:30 ` Peter Zijlstra
2017-07-27 13:08 ` Paul E. McKenney
2017-07-27 13:49 ` Peter Zijlstra
2017-07-27 14:32 ` Paul E. McKenney
2017-07-27 14:36 ` Peter Zijlstra
2017-07-27 14:46 ` Paul E. McKenney
2017-07-27 13:55 ` Boqun Feng
2017-07-27 14:16 ` Paul E. McKenney
2017-07-27 14:29 ` Boqun Feng
2017-07-27 14:36 ` Paul E. McKenney
2017-07-27 14:41 ` Will Deacon
2017-07-27 14:47 ` Boqun Feng
2017-07-27 14:55 ` Paul E. McKenney
2017-07-27 13:56 ` Peter Zijlstra
2017-07-27 15:19 ` Peter Zijlstra
2017-07-26 9:36 ` Will Deacon
2017-07-26 15:46 ` Paul E. McKenney
2017-07-27 10:14 ` Peter Zijlstra
2017-07-27 12:56 ` Paul E. McKenney
2017-07-27 13:37 ` Peter Zijlstra
2017-07-27 14:33 ` Paul E. McKenney
2017-07-24 21:58 ` [PATCH tip/core/rcu 5/5] EXP: sched/cputime: Fix using smp_processor_id() in preemptible Paul E. McKenney
2017-07-24 22:01 ` Wanpeng Li
2017-07-24 22:29 ` Paul E. McKenney
2017-07-31 22:51 ` [PATCH tip/core/rcu 0/5] Related non-RCU updates Paul E. McKenney
2017-07-31 22:53 ` [PATCH v2 tip/core/rcu 1/4] module: Fix pr_fmt() bug for header use of printk Paul E. McKenney
2017-07-31 22:53 ` [PATCH v2 tip/core/rcu 2/4] init_task: Remove redundant INIT_TASK_RCU_TREE_PREEMPT() macro Paul E. McKenney
2017-07-31 22:53 ` [PATCH v2 tip/core/rcu 3/4] sched: Allow migrating kthreads into online but inactive CPUs Paul E. McKenney
2017-07-31 22:53 ` [PATCH v2 tip/core/rcu 4/4] membarrier: Expedited private command Paul E. McKenney
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=20170727144439.GX3730@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.