[Intel-gfx] [PATCH 4/6] drm/i915: Discard objects from mm global_list after being shrunk

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Tue Nov 1 08:29:03 UTC 2016


On 31/10/2016 10:26, Chris Wilson wrote:
> In the shrinker, we can safely remove an empty object (obj->mm.pages ==
> NULL) after having discarded the pages because we are holding the
> struct_mutex.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_gem_shrinker.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
> index 0241658af16b..b504ba091c4f 100644
> --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
> +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
> @@ -226,6 +226,7 @@ i915_gem_shrink(struct drm_i915_private *dev_priv,
>  				mutex_lock(&obj->mm.lock);
>  				if (!obj->mm.pages) {
>  					__i915_gem_object_invalidate(obj);
> +					list_del_init(&obj->global_list);
>  					count += obj->base.size >> PAGE_SHIFT;
>  				}
>  				mutex_unlock(&obj->mm.lock);
>

This matches the same loop a bit higher up so from that POV:

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Regards,

Tvrtko


More information about the Intel-gfx mailing list