> > > rcu_read_lock();
> > > map = rcu_dereference(d->cur_map)
> > > if (unlikely(d->prev_map!=map) {
> > >     d->root = map->root;
> > >     d->pgtbl = map->pgtbl;
> > > }
> > > ......
> > > rcu_read_unlock();
> > >
> > > Then it can avoid ABA problem.
> >
> > I don't see the assignment of prev_map, which is where the ABA problem
> > arises.

If you do this:

> rcu_read_lock();
> map = rcu_derefenrence(d->cur_map)
> if (unlikely(d->prev_map!=map) {
>     d->root = map->root;
>     d->pgtbl = map->pgtbl;
>     d->prev_map = map;
> }
> ....
> rcu_read_unlock();

It can happen.  The problem is that prev_map can change _after_
the rcu_read_unlock.  It is the same as your previous solution.
Please just use the load-and-check idiom.  I'll post my RCU
implementation as soon as I finish the documentation.

Paolo

Reply via email to