• Thomas Hellstrom's avatar
    drm/vmwgfx: Look up objects without taking a reference · e14c02e6
    Thomas Hellstrom authored
    Typically when we look up objects under the rcu lock, we take a reference
    to make sure the returned object pointer is valid.
    Now provide a function to look up an object and instead of taking a
    reference to it, keep the rcu lock held when returning the object pointer.
    This means that the object pointer is valid as long as the rcu lock is
    held, but the object may be doomed (its refcount may be zero). Any
    persistent usage of the object pointer outside of the rcu lock requires
    a reference to be taken using kref_get_unless_zero().
    Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: default avatarSinclair Yeh <syeh@vmware.com>
    e14c02e6
ttm_object.c 20.9 KB