public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>,
	mingo@elte.hu, KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Nicholas Miell <nmiell@comcast.net>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	laijs@cn.fujitsu.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, dvhltc@us.ibm.com, niv@us.ibm.com,
	tglx@linutronix.de, peterz@infradead.org,
	Valdis.Kletnieks@vt.edu, dhowells@redhat.com,
	Nick Piggin <npiggin@suse.de>,
	Chris Friesen <cfriesen@nortel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] introduce sys_membarrier(): process-wide memory barrier (v10)
Date: Mon, 5 Apr 2010 14:08:34 -0700	[thread overview]
Message-ID: <20100405210833.GA17206@feather> (raw)
In-Reply-To: <20100405191057.GB13309@Krystal>

On Mon, Apr 05, 2010 at 03:10:57PM -0400, Mathieu Desnoyers wrote:
> * Randy Dunlap (randy.dunlap@oracle.com) wrote:
> > On Mon, 5 Apr 2010 13:57:37 -0400 Mathieu Desnoyers wrote:
> > > +/*
> > > + * sys_membarrier - issue memory barrier on current process running threads
> > > + * @flags: One of these must be set:
> > > + *         MEMBARRIER_EXPEDITED
> > > + *             Adds some overhead, fast execution (few microseconds)
> > > + *         MEMBARRIER_DELAYED
> > > + *             Low overhead, but slow execution (few milliseconds)
> > > + *
> > > + *         MEMBARRIER_QUERY
> > > + *           This optional flag can be set to query if the kernel supports
> > > + *           a set of flags.
> > > + *
> > > + * return values: Returns -EINVAL if the flags are incorrect. Testing for kernel
> > > + * sys_membarrier support can be done by checking for -ENOSYS return value.
> > > + * Return values >= 0 indicate success. For a given set of flags on a given
> > > + * kernel, this system call will always return the same value. It is therefore
> > > + * correct to check the return value only once at library load, passing the
> > 
> > library load assumes caller is a library?  does the kernel care about that?
> 
> Nope, it doesn't. Will rephrase:
> 
>     ... It is therefore
>  * correct to check the return value only once during a process lifetime,
>  * passing the MEMBARRIER_QUERY flag in addition to only check if the flags are
>  * supported, without performing any synchronization.

Technically you can optimize even more than "process lifetime", since as
you said the results hold "For a given set of flags on a given kernel".
So you could check once and use the results as long as you remain on the
same running system.  (Craziness like live process migration and
checkpoint/restart aside. :) )

- Josh Triplett

  parent reply	other threads:[~2010-04-05 21:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-05 17:57 [PATCH] introduce sys_membarrier(): process-wide memory barrier (v10) Mathieu Desnoyers
2010-04-05 18:38 ` Randy Dunlap
2010-04-05 19:10   ` Mathieu Desnoyers
2010-04-05 20:40     ` Paul E. McKenney
2010-04-05 20:23       ` Randy Dunlap
2010-04-05 21:39         ` Paul E. McKenney
2010-04-05 22:01           ` Mathieu Desnoyers
2010-04-05 21:08     ` Josh Triplett [this message]
2010-04-05 22:08       ` 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=20100405210833.GA17206@feather \
    --to=josh@joshtriplett.org \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=cfriesen@nortel.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=dvhltc@us.ibm.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@elte.hu \
    --cc=niv@us.ibm.com \
    --cc=nmiell@comcast.net \
    --cc=npiggin@suse.de \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=randy.dunlap@oracle.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --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