All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH 11/11] drm/i915: Maintain LRU order of inactive objects upon access by CPU
Date: Fri,  2 Jul 2010 15:02:21 +0100	[thread overview]
Message-ID: <1278079341-3630-12-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <1278079341-3630-1-git-send-email-chris@chris-wilson.co.uk>

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 <chris@chris-wilson.co.uk>
---
 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 bb7d6a9..26d0345 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1036,6 +1036,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);
+
 	drm_gem_object_unreference(obj);
 	mutex_unlock(&dev->struct_mutex);
 	return ret;
@@ -1169,6 +1173,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) +
 		page_offset;
 
-- 
1.7.1

  parent reply	other threads:[~2010-07-02 14:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-02 14:02 Fair eviction for i915, based on Daniel's drm_mm scanner Chris Wilson
2010-07-02 14:02 ` [PATCH 01/11] drm: use list_for_each_entry in drm_mm.c Chris Wilson
2010-07-02 14:02 ` [PATCH 02/11] drm: kill drm_mm_node->private Chris Wilson
2010-07-02 14:02 ` [PATCH 03/11] drm: kill dead code in drm_mm.c Chris Wilson
2010-07-02 14:02 ` [PATCH 04/11] drm: sane naming for drm_mm.c Chris Wilson
2010-07-02 14:02 ` [PATCH 05/11] drm_mm: extract check_free_mm_node Chris Wilson
2010-07-02 14:02 ` [PATCH 06/11] drm: implement helper functions for scanning lru list Chris Wilson
2010-07-02 14:02 ` [PATCH 07/11] drm/i915: prepare for fair lru eviction Chris Wilson
2010-07-02 14:45   ` [Intel-gfx] " Chris Wilson
2010-07-08 18:31   ` Eric Anholt
2010-07-08 20:11     ` [PATCH] drm/i915: prepare for fair lru eviction (v2) Chris Wilson
2010-07-02 14:02 ` [PATCH 08/11] drm/i915: Use a common seqno for all rings Chris Wilson
2010-07-02 14:02 ` [PATCH 09/11] drm/i915: Move the eviction logic to its own file Chris Wilson
2010-07-02 14:02 ` [PATCH 10/11] drm/i915: Implement fair lru eviction across both rings Chris Wilson
2010-07-02 14:02 ` Chris Wilson [this message]
2010-07-06  7:13 ` Fair eviction for i915, based on Daniel's drm_mm scanner Eric Anholt
2010-07-07  2:53   ` Dave Airlie

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=1278079341-3630-12-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.