Re: [CI 4/7] drm/i915: Simplify releasing context reference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 19, 2016 at 05:49:46PM +0800, Zhenyu Wang wrote:
> On 2016.12.18 15:37:21 +0000, Chris Wilson wrote:
> > A few users only take the struct_mutex in order to release a reference
> > to a context. We can expose a kref_put_mutex() wrapper in order to
> > simplify these users, and optimise taking of the mutex to the final
> > unref.
> > 
> > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> > ---
> >  drivers/gpu/drm/i915/i915_drv.h  |  7 +++++++
> >  drivers/gpu/drm/i915/i915_perf.c | 16 ++++------------
> >  2 files changed, 11 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index dec4ddf132f7..6217f01d3c11 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -3518,6 +3518,13 @@ static inline void i915_gem_context_put(struct i915_gem_context *ctx)
> >  	kref_put(&ctx->ref, i915_gem_context_free);
> >  }
> >  
> > +static inline void i915_gem_context_put_unlocked(struct i915_gem_context *ctx)
> > +{
> > +	kref_put_mutex(&ctx->ref,
> > +		       i915_gem_context_free,
> > +		       &ctx->i915->drm.struct_mutex);
> > +}
> > +
> 
> For kref_put_mutex() in final release func should unlock mutex, but I haven't
> seen i915_gem_context_free() to handle that?

No, I just completely forgot the asymmetry built into kref_put_mutex().
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux