On ma, 2016-07-25 at 08:44 +0100, Chris Wilson wrote:
> The obj->batch_pool_link is only inspected when traversing the batch
> pool list and when on the batch pool list the object is referenced. Thus
> when freeing the batch pool list, we only need to unreference the object
> and do not have to worry about the obj->batch_pool_link.
> 
> Signed-off-by: Chris Wilson <[email protected]>
> ---
>  drivers/gpu/drm/i915/i915_gem_batch_pool.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_batch_pool.c 
> b/drivers/gpu/drm/i915/i915_gem_batch_pool.c
> index 3507b2753fd3..825981b5aa40 100644
> --- a/drivers/gpu/drm/i915/i915_gem_batch_pool.c
> +++ b/drivers/gpu/drm/i915/i915_gem_batch_pool.c
> @@ -68,15 +68,14 @@ void i915_gem_batch_pool_fini(struct i915_gem_batch_pool 
> *pool)
>       WARN_ON(!mutex_is_locked(&pool->dev->struct_mutex));
>  
>       for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++) {
> -             while (!list_empty(&pool->cache_list[n])) {
> -                     struct drm_i915_gem_object *obj =
> -                             list_first_entry(&pool->cache_list[n],
> -                                              struct drm_i915_gem_object,
> -                                              batch_pool_link);
> +             struct drm_i915_gem_object *obj, *next;
>  
> -                     list_del(&obj->batch_pool_link);
> +             list_for_each_entry_safe(obj, next,

Why _safe? i915_gem_free_object does not touch the batch_pool_link.

Regards, Joonas

> +                                      &pool->cache_list[n],
> +                                      batch_pool_link)
>                       i915_gem_object_put(obj);
> -             }
> +
> +             INIT_LIST_HEAD(&pool->cache_list[n]);
>       }
>  }
>  
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to