Re: [Lse-tech] Re: RFC: patch to allow lock-free traversal of lists with insertion

Rusty Russell (rusty@rustcorp.com.au)
Fri, 12 Oct 2001 13:27:33 +1000


On Wed, 10 Oct 2001 03:18:23 -0700 (PDT)
Linus Torvalds <torvalds@transmeta.com> wrote:

> lock
> unhash
> unlock
> if (atomic_dec()) {
> free
> }

And the read side is:
lock
loopup
atomic_inc
unlock

With RCU, read side is:
loopup
atomic_inc

Write is:
lock /* protect against other writes */
unhash /* be careful with wmb()s here... */
unlock
call_rcu(if (atomic_dec()) free) /* ie. does this later */

Clear?
Rusty.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/