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

Steven Rostedt
2010-01-09T23:16:45Z

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);
>

-- Steve