提交 9b5f4e5e 编写于 作者: C Chris Wilson

drm/i915: Retire oldest completed request before allocating next

In order to keep the memory allocated for requests reasonably tight, try
to reuse the oldest request (so long as it is completed and has no
external references) for the next allocation.

v2: Throw in a comment to hopefully make sure no one mistakes the
optimistic retirement of the oldest request for simply stealing it.
Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1469002875-2335-2-git-send-email-chris@chris-wilson.co.uk
上级 05235c53
......@@ -226,6 +226,14 @@ __i915_gem_request_alloc(struct intel_engine_cs *engine,
if (ret)
return ret;
/* Move the oldest request to the slab-cache (if not in use!) */
if (!list_empty(&engine->request_list)) {
req = list_first_entry(&engine->request_list,
typeof(*req), list);
if (i915_gem_request_completed(req))
i915_gem_request_retire(req);
}
req = kmem_cache_zalloc(dev_priv->requests, GFP_KERNEL);
if (!req)
return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册