[Intel-gfx] [PATCH 04/31] drm/i915: Only drop the batch-pool's object reference
Joonas Lahtinen
joonas.lahtinen at linux.intel.com
Mon Jul 25 10:43:15 UTC 2016
On ma, 2016-07-25 at 09:44 +0100, Chris Wilson wrote:
> On Mon, Jul 25, 2016 at 11:38:07AM +0300, Joonas Lahtinen wrote:
> >
> > 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 <chris at chris-wilson.co.uk>
> > > ---
> > > 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.
Yeah, that'd be true.
Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Not directly, but it does free the memory including the batch_pool_link. :)
> -Chris
>
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
More information about the Intel-gfx
mailing list