[Intel-gfx] [PATCH 08/17] drm/i915: Drop spinlocks around adding to the client request list

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 24 13:25:02 UTC 2016


On Wed, Aug 24, 2016 at 04:16:55PM +0300, Mika Kuoppala wrote:
> Chris Wilson <chris at chris-wilson.co.uk> writes:
> > index 7b8abda541e6..e432211e8b24 100644
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -3673,16 +3673,14 @@ i915_gem_ring_throttle(struct drm_device *dev, struct drm_file *file)
> >  		return -EIO;
> >  
> >  	spin_lock(&file_priv->mm.lock);
> > -	list_for_each_entry(request, &file_priv->mm.request_list, client_list) {
> > +	list_for_each_entry(request, &file_priv->mm.request_list, client_link) {
> >  		if (time_after_eq(request->emitted_jiffies, recent_enough))
> >  			break;
> >  
> > -		/*
> > -		 * Note that the request might not have been submitted yet.
> > -		 * In which case emitted_jiffies will be zero.
> > -		 */
> > -		if (!request->emitted_jiffies)
> > -			continue;
> > +		if (target) {
> > +			list_del(&target->client_link);
> > +			target->file_priv = NULL;
> 
> No need for list_for_each_entry_safe as we are throwing out stuff before
> the point of traversal?

Exactly, there is a very strict ordering here. We are deleting before
the cursor and we only ever add at the end (which is past the cursor).
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list