tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: The missing membar_X() directive



On 14 Jul 2010, at 07:50 , Christos Zoulas wrote:

>> I have a route lookup data structure which is fairly speedy and
>> which is designed to be modified (i.e. routes added or deleted)
>> while lookups are concurrently being done.  This is part of a
>> project to produce a fully SMP-capable networking stack.
[...]
> Would RCU be helpful in your scenario?

I didn't know there was a name for that but, yes, that's how it
works.  When something is removed from the structure the memory
allocator needs to hang on to the now-detached memory and keep
it unchanged until it can prove that all lookups which might have
started before the change have finished.  The (only) thing which
requires the memory barriers is that when you add something to the
structure you first initialize the new memory to the state it
needs to be in when it is added, and then modify pointers in the
existing structure to point at the new memory.  The initialization
done needs to be visible to all processors before the changes to
the pointers become visible.

The wikipedia article on RCU, here

    http://en.wikipedia.org/wiki/Read-copy-update

in section 3 actually mentions the problem with the Alpha which
requires the read memory barriers for that processor only.

Dennis Ferguson


Home | Main Index | Thread Index | Old Index