Re: [RFC PATCH] introduce sys_membarrier(): process-wide memorybarrier

From: Paul E. McKenney
Date: Thu Jan 07 2010 - 11:40:04 EST


On Thu, Jan 07, 2010 at 09:32:16AM +0100, Peter Zijlstra wrote:
> On Wed, 2010-01-06 at 21:02 -0800, Paul E. McKenney wrote:
> >
> > Beats the heck out of user-mode signal handlers!!! And it is hard
> > to imagine groveling through runqueues ever being a win, even on very
> > large systems. The only reasonable optimization I can imagine is to
> > turn this into a no-op for a single-threaded process, but there are
> > other ways to do that optimization.
> >
> > Reviewed-by: "Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx>
>
> Then imagine someone doing:
>
> while (1)
> sys_membarrier();
>
> on your multi node machine, see how happy you are then.

I guess in that situation, I would be feeling no pain. Or anything else
for that matter. :-/

So, good point!!! I stand un-Reviewed-By.

I could imagine throttling the requests, as well as batching them. If
any CPU does a sys_membarrier() after this CPU's sys_membarrier has
entered the kernel, then this CPU can simply return. A token-bucket
approach could throttle things nicely, but at some point it becomes
better to just do POSIX signals.

Thanx, Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/