From: Thomas Gleixner <tglx@linutronix.de>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: linux-kernel@vger.kernel.org,
Josh Triplett <josh@joshtriplett.org>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Steven Rostedt <rostedt@goodmis.org>,
Nicholas Miell <nmiell@comcast.net>,
Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@redhat.com>,
Alan Cox <gnomes@lxorguk.ukuu.org.uk>,
Lai Jiangshan <laijs@cn.fujitsu.com>,
Stephen Hemminger <stephen@networkplumber.org>,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
David Howells <dhowells@redhat.com>,
Pranith Kumar <bobby.prani@gmail.com>,
Michael Kerrisk <mtk.manpages@gmail.com>
Subject: Re: [PATCH v16] sys_membarrier(): system-wide memory barrier (generic, x86)
Date: Tue, 21 Apr 2015 13:47:38 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.11.1504211338580.13914@nanos> (raw)
In-Reply-To: <1429283202-6245-1-git-send-email-mathieu.desnoyers@efficios.com>
On Fri, 17 Apr 2015, Mathieu Desnoyers wrote:
> +/**
> + * enum membarrier_cmd - membarrier system call command
> + *
* @MEMBARRIER_CMD_QUERY: Explanatory blurb......
Hint: Create a kerneldoc document and build it.
> + * Command to be passed to the membarrier system call.
Please epxlain, that the commands need to be a single bit each.
> +config MEMBARRIER
> + bool "Enable membarrier() system call" if EXPERT
> + default y
> + depends on SMP
> + help
> + Enable the membarrier() system call that allows issuing memory
> + barriers across all running threads, which can be used to distribute
> + the cost of user-space memory barriers asymmetrically by transforming
> + pairs of memory barriers into pairs consisting of membarrier() and a
> + compiler barrier.
> +
> + If unsure, say Y.
Is it really worth to make this configurable?
> +/**
> + * sys_membarrier - issue memory barriers on a set of threads
> + * @cmd: MEMBARRIER_CMD_QUERY:
> + * Query the set of supported commands. It returns a bitmask of
> + * supported commands.
> + * MEMBARRIER_CMD_SHARED:
> + * Execute a memory barrier on all running threads. Upon
> + * return from system call, the caller thread is ensured that
> + * all running threads have passed through a state where all
> + * memory accesses to user-space addresses match program order
> + * between entry to and return from the system call (non-running
> + * threads are de facto in such a state). This covers threads
> + * from all processes running on the system. This command
> + * returns 0.
I think the explanation for the commands should be in the enum
documentation. This here should explain that @cmd takes command values
defined in the enum.
> +SYSCALL_DEFINE2(membarrier, int, cmd, int, flags)
> +{
> + switch (cmd) {
> + case MEMBARRIER_CMD_QUERY:
> + return MEMBARRIER_CMD_BITMASK;
> + case MEMBARRIER_CMD_SHARED:
> + if (num_online_cpus() > 1)
> + synchronize_sched();
> + return 0;
> + default:
> + return -EINVAL;
> + }
> +}
This looks way cleaner now :)
Thanks,
tglx
next prev parent reply other threads:[~2015-04-21 11:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 15:06 Mathieu Desnoyers
2015-04-21 11:47 ` Thomas Gleixner [this message]
2015-04-22 20:36 ` Mathieu Desnoyers
2015-04-21 16:29 ` Davidlohr Bueso
2015-04-22 19:43 ` Mathieu Desnoyers
2015-04-22 20:01 ` Michael Kerrisk (man-pages)
2015-04-22 21:01 ` Mathieu Desnoyers
2015-04-23 11:38 ` Michael Kerrisk (man-pages)
2015-04-22 20:24 ` Pranith Kumar
2015-04-22 20:40 ` Mathieu Desnoyers
2015-04-23 0:37 ` Pranith Kumar
2015-04-23 0:40 ` Stephen Hemminger
2015-04-23 2:48 ` Steven Rostedt
2015-04-23 13:45 ` Mathieu Desnoyers
2015-04-23 10:33 ` Rasmus Villemoes
2015-04-23 14:04 ` Mathieu Desnoyers
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=alpine.DEB.2.11.1504211338580.13914@nanos \
--to=tglx@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=bobby.prani@gmail.com \
--cc=dhowells@redhat.com \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=josh@joshtriplett.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@redhat.com \
--cc=mtk.manpages@gmail.com \
--cc=nmiell@comcast.net \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=stephen@networkplumber.org \
--cc=torvalds@linux-foundation.org \
/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
all inboxes | Powered by JetHome®