[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150316172445.GI21418@twins.programming.kicks-ass.net>
Date: Mon, 16 Mar 2015 18:24:45 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: linux-kernel@...r.kernel.org,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Steven Rostedt <rostedt@...dmis.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Nicholas Miell <nmiell@...cast.net>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Ingo Molnar <mingo@...hat.com>,
Alan Cox <gnomes@...rguk.ukuu.org.uk>,
Lai Jiangshan <laijs@...fujitsu.com>,
Stephen Hemminger <stephen@...workplumber.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Josh Triplett <josh@...htriplett.org>,
Thomas Gleixner <tglx@...utronix.de>,
David Howells <dhowells@...hat.com>,
Nick Piggin <npiggin@...nel.dk>
Subject: Re: [RFC PATCH] sys_membarrier(): system/process-wide memory barrier
(x86) (v12)
On Mon, Mar 16, 2015 at 03:43:56PM +0000, Mathieu Desnoyers wrote:
> > > +enum {
> > > + /*
> > > + * Private flag set: only synchronize across a single process. If this
> > > + * flag is not set, it means "shared": synchronize across multiple
> > > + * processes. The shared mode is useful for shared memory mappings
> > > + * across processes.
> > > + */
> > > + MEMBARRIER_PRIVATE_FLAG = (1 << 0),
> > > +
> > > + /*
> > > + * Expedited flag set: adds some overhead, fast execution (few
> > > + * microseconds). If this flag is not set, it means "delayed": low
> > > + * overhead, but slow execution (few milliseconds).
> > > + */
> > > + MEMBARRIER_EXPEDITED_FLAG = (1 << 1),
> >
> >
> > I suppose this is an unprivileged syscall; so what do we do about:
> >
> > for (;;)
> > sys_membar(EXPEDITED);
> >
> > Which would spray the entire system with IPIs at break neck speed.
>
> Currently, combining EXPEDITED with non-PRIVATE returns -EINVAL.
Ah, tl;dr that bit. This patch really had _too_ much verbiage.
> Therefore, if someone cares about issuing barriers on the entire
> system, the only option is to use non-EXPEDITED, which rely on
> synchronize_rcu().
>
> The only way to invoke expedited barriers in a loop is:
>
> for (;;)
> sys_membarrier(MEMBARRIER_EXPEDITED | MEMBARRIER_PRIVATE);
>
> Which will only send IPIs to the CPU running threads from the same
> process.
That is indeed less of a problem.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists