Intel-GFX Archive on
 help / color / Atom feed
From: Chris Wilson <>
Subject: [PATCH 2/2] drm/i915: Maintain LRU order of inactive objects upon access by CPU
Date: Thu,  1 Jul 2010 17:53:45 +0100
Message-ID: <> (raw)
In-Reply-To: <>

In order to reduce the penalty of fallbacks under memory pressure and to
avoid a potential immediate ping-pong of evicting a mmaped buffer, we
move the object to the tail of the inactive list when a page is freshly
faulted or the object is moved into the CPU domain.

We choose not to protect the CPU objects from casual eviction,
preferring to keep the GPU active for as long as possible.

Signed-off-by: Chris Wilson <>
 drivers/gpu/drm/i915/i915_gem.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 7d20901..c310fbe 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1072,6 +1072,10 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
 		ret = i915_gem_object_set_to_cpu_domain(obj, write_domain != 0);
+	/* Maintain LRU order of "inactive" objects */
+	if (ret == 0 && obj_priv->gtt_space && !obj_priv->active)
+		list_move_tail(&obj_priv->list, &dev_priv->mm.inactive_list);
 	return ret;
@@ -1205,6 +1209,9 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 			goto unlock;
+	if (!obj_priv->active)
+		list_move_tail(&obj_priv->list, &dev_priv->mm.inactive_list);
 	pfn = ((dev->agp->base + obj_priv->gtt_offset) >> PAGE_SHIFT) +

  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-01 16:53 [PATCH 1/2] [RFC] drm/i915: Restore LRU evict order, with a twist! Chris Wilson
2010-07-01 16:53 ` Chris Wilson [this message]
2010-07-01 19:49 ` Eric Anholt
2010-07-01 20:36   ` Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Intel-GFX Archive on

Archives are clonable:
	git clone --mirror intel-gfx/git/0.git
	git clone --mirror intel-gfx/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 intel-gfx intel-gfx/ \
	public-inbox-index intel-gfx

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone