Linus Torvalds writes: (Summary) So the code
that does *creation* can do this:
that does *creation* can do this:
- get subsystem lock
- look up object (using the "unless_zero()" model) - if you got the object, re-use it, and you're done: drop lock and return - otherwise, you know that nobody else can get it either - create new object and instantiate it
- drop lock
- drop lock
and this means that you create a new object IFF the old object had its refcount drop to zero.
that does *creation* can do this:
- get subsystem lock
- look up object (using the "unless_zero()" model) - if you got the object, re-use it, and you're done: drop lock and return - otherwise, you know that nobody else can get it either - create new object and instantiate it
- drop lock
- drop lock
and this means that you create a new object IFF the old object had its refcount drop to zero.