Messages in this thread |  | | | Subject | Re: [PATCH RFC tip/core/rcu] rcu: direct algorithmic SRCU implementation | | From | Peter Zijlstra <> | | Date | Thu, 16 Feb 2012 15:58:22 +0100 |
| |
On Thu, 2012-02-16 at 09:52 -0500, Mathieu Desnoyers wrote: > Ah, so this is what I missed: the context switch has its lock/unlock > pair, the following migration is performed under its own lock/unlock > pair, and the following context switch also has its lock/unlock pair. So > yes, this should be sufficient to act as a full memory barrier.
In fact it typically looks like:
LOCK(rq0->lock) switch-from-A UNLOCK(rq0->lock);
LOCK(rq0->lock); LOCK(rq1->lock); migrate-A UNLOCK(rq1->lock); UNLOCK(rq0->lock);
LOCK(rq1->lock); switch-to-A UNLOCK(rq1->lock);
the migrate taking both locks involved guarantees that the switch-to always comes _after_ the switch_from. The migrate might be performed on a completely unrelated cpu although typically it would be either the old (push) or the new (pull).
|  |