Commit 0f646425 authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm: Use a normal idr allocation for the obj->name

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: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1451902261-25380-3-git-send-email-chris@chris-wilson.co.ukSigned-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 98a8883a
...@@ -642,7 +642,6 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data, ...@@ -642,7 +642,6 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
return -ENOENT; return -ENOENT;
mutex_lock(&dev->object_name_lock); mutex_lock(&dev->object_name_lock);
idr_preload(GFP_KERNEL);
/* prevent races with concurrent gem_close. */ /* prevent races with concurrent gem_close. */
if (obj->handle_count == 0) { if (obj->handle_count == 0) {
ret = -ENOENT; ret = -ENOENT;
...@@ -650,7 +649,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data, ...@@ -650,7 +649,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
} }
if (!obj->name) { 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) if (ret < 0)
goto err; goto err;
...@@ -661,7 +660,6 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data, ...@@ -661,7 +660,6 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
ret = 0; ret = 0;
err: err:
idr_preload_end();
mutex_unlock(&dev->object_name_lock); mutex_unlock(&dev->object_name_lock);
drm_gem_object_unreference_unlocked(obj); drm_gem_object_unreference_unlocked(obj);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment