lkml.org 
[lkml]   [2012]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH RFC tip/core/rcu] rcu: direct algorithmic SRCU implementation
From
Date
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).


\
 
 \ /
  Last update: 2012-02-16 16:01    [from the cache]
©2003-2011 Jasper Spaans