[PATCH 06/20] drm/gem: inline drm_gem_object_handle_reference

Daniel Vetter daniel.vetter at ffwll.ch
Tue Jul 23 05:31:07 PDT 2013


On Tue, Jul 23, 2013 at 2:07 PM, Rob Clark <robdclark at gmail.com> wrote:
> On Tue, Jul 16, 2013 at 3:11 AM, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
>> Only one callsite and since ->handle_count is not a simple reference
>> count (it can resurrect) it's imo better to be explicit about things
>> than hide the refcount dance.
>
> I'm not really sure I like this one.. I guess it could be that I'm
> just used to the handle-ref stuff, so it doesn't seem odd not-inlined.
>  And it does seem kinda odd / unsymmetric to have an unref w/out a
> ref.  I guess I kinda like the bikeshed's current color in this case.

I generally agree but in this case a follow-up patch ("drm/gem: fix up
flink name create race") will change obj->handle_count from an
atomic_t to a normal int protected by the dev->object_name_lock
spinlock. To avoid races we need to hold that spinlock over a few
different instructions, so with the refcounting dance inlined it's
much more obvious that that obj->handle_count is always correctly
protected imo.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dri-devel mailing list