diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_active.c')
| -rw-r--r-- | drivers/gpu/drm/i915/i915_active.c | 20 | 
1 files changed, 10 insertions, 10 deletions
| diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c index 3bc616cc1ad2..cf9a3d384971 100644 --- a/drivers/gpu/drm/i915/i915_active.c +++ b/drivers/gpu/drm/i915/i915_active.c @@ -293,18 +293,13 @@ static struct active_node *__active_lookup(struct i915_active *ref, u64 idx)  static struct i915_active_fence *  active_instance(struct i915_active *ref, u64 idx)  { -	struct active_node *node, *prealloc; +	struct active_node *node;  	struct rb_node **p, *parent;  	node = __active_lookup(ref, idx);  	if (likely(node))  		return &node->base; -	/* Preallocate a replacement, just in case */ -	prealloc = kmem_cache_alloc(global.slab_cache, GFP_KERNEL); -	if (!prealloc) -		return NULL; -  	spin_lock_irq(&ref->tree_lock);  	GEM_BUG_ON(i915_active_is_idle(ref)); @@ -314,10 +309,8 @@ active_instance(struct i915_active *ref, u64 idx)  		parent = *p;  		node = rb_entry(parent, struct active_node, node); -		if (node->timeline == idx) { -			kmem_cache_free(global.slab_cache, prealloc); +		if (node->timeline == idx)  			goto out; -		}  		if (node->timeline < idx)  			p = &parent->rb_right; @@ -325,7 +318,14 @@ active_instance(struct i915_active *ref, u64 idx)  			p = &parent->rb_left;  	} -	node = prealloc; +	/* +	 * XXX: We should preallocate this before i915_active_ref() is ever +	 *  called, but we cannot call into fs_reclaim() anyway, so use GFP_ATOMIC. +	 */ +	node = kmem_cache_alloc(global.slab_cache, GFP_ATOMIC); +	if (!node) +		goto out; +  	__i915_active_fence_init(&node->base, NULL, node_retire);  	node->ref = ref;  	node->timeline = idx; | 
