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

From: Paul E. McKenney
Date: Sun Jan 10 2010 - 00:19:48 EST


On Sat, Jan 09, 2010 at 08:12:55PM -0500, Mathieu Desnoyers wrote:
> * Paul E. McKenney (paulmck@xxxxxxxxxxxxxxxxxx) wrote:
> > On Sat, Jan 09, 2010 at 06:16:40PM -0500, Steven Rostedt wrote:
> > > On Sat, 2010-01-09 at 18:05 -0500, Steven Rostedt wrote:
> > >
> > > > Then we should have O(tasks) for spinlocks taken, and
> > > > O(min(tasks, CPUS)) for IPIs.
> > >
> > > And for nr tasks >> CPUS, this may help too:
> > >
> > > > cpumask = 0;
> > > > foreach task {
> > >
> > > if (cpumask == online_cpus)
> > > break;
> > >
> > > > spin_lock(task_rq(task)->rq->lock);
> > > > if (task_rq(task)->curr == task)
> > > > cpu_set(task_cpu(task), cpumask);
> > > > spin_unlock(task_rq(task)->rq->lock);
> > > > }
> > > > send_ipi(cpumask);
> >
> > Good point, erring on the side of sending too many IPIs is safe. One
> > might even be able to just send the full set if enough of the CPUs were
> > running the current process and none of the remainder were running
> > real-time threads. And yes, it would then be necessary to throttle
> > calls to sys_membarrier().
> >
> > Quickly hiding behind a suitable boulder... ;-)
>
> :)
>
> One quick counter-argument against IPI-to-all: that will wake up all
> CPUs, including those which are asleep. Not really good for
> energy-saving.

Good point.

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/