From patchwork Tue Dec 1 17:40:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 64014 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nB1HekQE013549 for ; Tue, 1 Dec 2009 17:40:46 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D60429F009; Tue, 1 Dec 2009 09:40:46 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from azsmga102.ch.intel.com (mga12.intel.com [143.182.124.36]) by gabe.freedesktop.org (Postfix) with ESMTP id F05B19F002 for ; Tue, 1 Dec 2009 09:40:44 -0800 (PST) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 01 Dec 2009 09:40:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.47,316,1257148800"; d="scan'208";a="217533696" Received: from unknown (HELO localhost.localdomain) ([10.255.16.235]) by azsmga001.ch.intel.com with ESMTP; 01 Dec 2009 09:40:42 -0800 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Tue, 1 Dec 2009 17:40:36 +0000 Message-Id: <1259689236-2896-1-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 1.6.5.3 Subject: [Intel-gfx] [PATCH] drm/i915: Evict everything if we detect we are buffer thrashing X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org 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);