Commit c4e64881 authored by Chris Wilson's avatar Chris Wilson

drm/i915/selftests: Try to recycle context allocations

igt_ctx_exec allocates a new context for each iteration, keeping them
all allocated until the end. Instead, release the local ctx reference at
the end of each iteration, allowing ourselves to reap those if under
mempressure.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190827161726.3640-2-chris@chris-wilson.co.uk
parent f2085c8e
...@@ -424,7 +424,7 @@ static int igt_ctx_exec(void *arg) ...@@ -424,7 +424,7 @@ static int igt_ctx_exec(void *arg)
struct i915_gem_context *ctx; struct i915_gem_context *ctx;
struct intel_context *ce; struct intel_context *ce;
ctx = live_context(i915, file); ctx = kernel_context(i915);
if (IS_ERR(ctx)) { if (IS_ERR(ctx)) {
err = PTR_ERR(ctx); err = PTR_ERR(ctx);
goto out_unlock; goto out_unlock;
...@@ -438,6 +438,7 @@ static int igt_ctx_exec(void *arg) ...@@ -438,6 +438,7 @@ static int igt_ctx_exec(void *arg)
if (IS_ERR(obj)) { if (IS_ERR(obj)) {
err = PTR_ERR(obj); err = PTR_ERR(obj);
intel_context_put(ce); intel_context_put(ce);
kernel_context_close(ctx);
goto out_unlock; goto out_unlock;
} }
} }
...@@ -449,12 +450,14 @@ static int igt_ctx_exec(void *arg) ...@@ -449,12 +450,14 @@ static int igt_ctx_exec(void *arg)
engine->name, ctx->hw_id, engine->name, ctx->hw_id,
yesno(!!ctx->vm), err); yesno(!!ctx->vm), err);
intel_context_put(ce); intel_context_put(ce);
kernel_context_close(ctx);
goto out_unlock; goto out_unlock;
} }
err = throttle(ce, tq, ARRAY_SIZE(tq)); err = throttle(ce, tq, ARRAY_SIZE(tq));
if (err) { if (err) {
intel_context_put(ce); intel_context_put(ce);
kernel_context_close(ctx);
goto out_unlock; goto out_unlock;
} }
...@@ -467,6 +470,7 @@ static int igt_ctx_exec(void *arg) ...@@ -467,6 +470,7 @@ static int igt_ctx_exec(void *arg)
ncontexts++; ncontexts++;
intel_context_put(ce); intel_context_put(ce);
kernel_context_close(ctx);
} }
pr_info("Submitted %lu contexts to %s, filling %lu dwords\n", pr_info("Submitted %lu contexts to %s, filling %lu dwords\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment