[Intel-gfx] [PATCH 3/3] drm: Use a normal idr allocation for the obj->name

Daniel Vetter daniel at ffwll.ch
Tue Jan 5 00:00:22 PST 2016


On Mon, Jan 04, 2016 at 05:31:14PM +0200, Ville Syrjälä wrote:
> On Mon, Jan 04, 2016 at 10:11:01AM +0000, Chris Wilson wrote:
> > Unlike the handle, the name table uses a sleeping mutex rather than a
> > spinlock. The allocation is in a normal context, and we can use the
> > simpler sleeping gfp_t, rather than have to take from the atomic
> > reserves.
> > 
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

All 3 merged to drm-misc, thanks for patches&review.
-Daniel

> 
> > ---
> >  drivers/gpu/drm/drm_gem.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> > index ad955d7c99fd..1b0c2c127072 100644
> > --- a/drivers/gpu/drm/drm_gem.c
> > +++ b/drivers/gpu/drm/drm_gem.c
> > @@ -642,7 +642,6 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
> >  		return -ENOENT;
> >  
> >  	mutex_lock(&dev->object_name_lock);
> > -	idr_preload(GFP_KERNEL);
> >  	/* prevent races with concurrent gem_close. */
> >  	if (obj->handle_count == 0) {
> >  		ret = -ENOENT;
> > @@ -650,7 +649,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
> >  	}
> >  
> >  	if (!obj->name) {
> > -		ret = idr_alloc(&dev->object_name_idr, obj, 1, 0, GFP_NOWAIT);
> > +		ret = idr_alloc(&dev->object_name_idr, obj, 1, 0, GFP_KERNEL);
> >  		if (ret < 0)
> >  			goto err;
> >  
> > @@ -661,7 +660,6 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
> >  	ret = 0;
> >  
> >  err:
> > -	idr_preload_end();
> >  	mutex_unlock(&dev->object_name_lock);
> >  	drm_gem_object_unreference_unlocked(obj);
> >  	return ret;
> > -- 
> > 2.6.4
> > 
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Ville Syrjälä
> Intel OTC
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list