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

From: Linus Torvalds (
Date: Wed Oct 10 2001 - 04:36:13 EST

On Wed, 10 Oct 2001, Rusty Russell wrote:
> If noone *holds* a reference, you can remove it "sometime later",
> where "sometime later" is (for example) after every CPU has scheduled.

Ehh.. One of those readers can hold on to the thing while waiting for
something else to happen.

Looking up a data structure and copying it to user space or similar is
_the_ most common operation for any lookup. You MUST NOT free it just
because we scheduled away. Scheduling points have zero meaning in real

So you'll need a reference count to actually keep such a data structure
alive _over_ a schedule. Or all the readers need to copy the data too
before they actually start using it. At which point you've made your code
a _lot_ slower than the locking version.

Yeah, I can see that your data structure can be made to work by limiting
how you can use it ("you must never hold on to a entry over a schedule,
reference-counting is a no-no, and you have to stand on your left foot
when you look at it sideways").


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Oct 15 2001 - 21:00:31 EST