[Intel-gfx] [PATCH] drm/i915: Evict everything if we detect we are buffer thrashing

Ian Romanick idr at freedesktop.org
Wed Dec 2 01:12:30 CET 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris Wilson wrote:
> By scanning the inactive list for a single buffer to evict instead of
> just popping the first elements until we have sufficient room may be
> give measurably higher throughput, but opens the possibility of
> thrashing between two large objects. If we spot that this happening,
> then simply clear the entire aperture and start afresh. The alternate
> is the page-fault-of-doom!

I'm a little bit dubious of this approach.  Has this been tested on any
applications that, for example, use a lot of large textures?  I'm
concerned that this will cause performance regressions on such apps.

> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_gem.c |   15 ++++++++++++++-
>  1 files changed, 14 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 6dd451e..2f2ccbc 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2156,10 +2156,23 @@ i915_gem_evict_something(struct drm_device *dev, int min_size)
>  		if (obj) {
>  			struct drm_i915_gem_object *obj_priv;
>  
> +			obj_priv = obj->driver_private;
> +
> +			/* In the event that we have selected the most recently
> +			 * bound object to evict, then we are in the midst of
> +			 * thrashing the inactive list -- imagine a nearly full
> +			 * aperture and we are copying between large objects,
> +			 * only one of which can fit in at any one time. In
> +			 * this case it is better just to evict everything and
> +			 * start afresh -- or else suffer the page fault of
> +			 * doom.
> +			 */
> +			if (obj_priv->list.next == &dev_priv->mm.inactive_list)
> +				return i915_gem_evict_everything(dev);
> +
>  #if WATCH_LRU
>  			DRM_INFO("%s: evicting %p\n", __func__, obj);
>  #endif
> -			obj_priv = obj->driver_private;
>  			BUG_ON(obj_priv->pin_count != 0);
>  			BUG_ON(obj_priv->active);
>  

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksVsO0ACgkQX1gOwKyEAw+6LACeKj1ZX9LT7pLOnXbGsTv6fmf8
9wkAoIIexYlvPBHGRfmMmVwjJ6FYgDbk
=DM1F
-----END PGP SIGNATURE-----



More information about the Intel-gfx mailing list