[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100112163831.GB13063@Krystal>
Date: Tue, 12 Jan 2010 11:38:31 -0500
From: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Oleg Nesterov <oleg@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
akpm@...ux-foundation.org, josh@...htriplett.org,
tglx@...utronix.de, Valdis.Kletnieks@...edu, dhowells@...hat.com,
laijs@...fujitsu.com, dipankar@...ibm.com
Subject: Re: [RFC PATCH] introduce sys_membarrier(): process-wide memory
barrier (v3b)
* Steven Rostedt (rostedt@...dmis.org) wrote:
> On Tue, 2010-01-12 at 10:38 -0500, Mathieu Desnoyers wrote:
>
> > > The UP-kernel case is handled by the #ifdef in sys_membarrier(), though
> > > with a bit larger code footprint than the embedded guys would probably
> > > prefer. (Or is the compiler smart enough to omit these function given no
> > > calls to them? If not, recommend putting them under CONFIG_SMP #ifdef.)
> >
> > Hrm, that's a bit odd. I agree that UP systems could simply return
> > -ENOSYS for sys_membarrier, but then I wonder how userland could
> > distinguish between:
> >
> > - an old kernel not supporting sys_membarrier()
> > -> in this case we need to use the smp_mb() fallback on the read-side
> > and in synchronize_rcu().
> > - a recent kernel supporting sys_membarrier(), CONFIG_SMP
> > -> can use the barrier() on read-side, call sys_membarrier upon
> > update.
> > - a recent kernel supporting sys_membarrier, !CONFIG_SMP
> > -> calls to sys_membarrier() are not required, nor is barrier().
> >
> > Or maybe we just postpone the userland smp_mb() question to another
> > thread. This will eventually need to be addressed anyway. Maybe with a
> > vgetmaxcpu() vsyscall.
>
> I think Paul means to wrap all your other functions under the #ifdef.
> What you have for sys_membarrier() is fine (just return 0 on UP) but you
> also need to wrap the helper function above it under #ifdef CONFIG_SMP.
> Don't rely on the compiler to optimize them out. If anything, you'll
> probably get a bunch of warnings about static functions unused.
Ah! Indeed! Thanks for helping me see the light. ;)
Mathieu
>
> -- Steve
>
>
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
--
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