> * 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.