Skip to content

Commit c4e6488

Browse files
committed
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: Chris Wilson <[email protected]> Reviewed-by: Matthew Auld <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent f2085c8 commit c4e6488

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ static int igt_ctx_exec(void *arg)
424424
struct i915_gem_context *ctx;
425425
struct intel_context *ce;
426426

427-
ctx = live_context(i915, file);
427+
ctx = kernel_context(i915);
428428
if (IS_ERR(ctx)) {
429429
err = PTR_ERR(ctx);
430430
goto out_unlock;
@@ -438,6 +438,7 @@ static int igt_ctx_exec(void *arg)
438438
if (IS_ERR(obj)) {
439439
err = PTR_ERR(obj);
440440
intel_context_put(ce);
441+
kernel_context_close(ctx);
441442
goto out_unlock;
442443
}
443444
}
@@ -449,12 +450,14 @@ static int igt_ctx_exec(void *arg)
449450
engine->name, ctx->hw_id,
450451
yesno(!!ctx->vm), err);
451452
intel_context_put(ce);
453+
kernel_context_close(ctx);
452454
goto out_unlock;
453455
}
454456

455457
err = throttle(ce, tq, ARRAY_SIZE(tq));
456458
if (err) {
457459
intel_context_put(ce);
460+
kernel_context_close(ctx);
458461
goto out_unlock;
459462
}
460463

@@ -467,6 +470,7 @@ static int igt_ctx_exec(void *arg)
467470
ncontexts++;
468471

469472
intel_context_put(ce);
473+
kernel_context_close(ctx);
470474
}
471475

472476
pr_info("Submitted %lu contexts to %s, filling %lu dwords\n",

0 commit comments

Comments
 (0)