summaryrefslogtreecommitdiff
path: root/tests/i915/gem_userptr_blits.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-01-15 20:50:24 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2019-01-16 11:08:19 +0000
commit8477ed9aeeaa8afb491d73a4c53d1b7dc64413c6 (patch)
tree1f1e252fa6b2c9229a498681ec9d431c1d91b9cf /tests/i915/gem_userptr_blits.c
parent951e2b1a016b750544d0f42459b13b9c70631c68 (diff)
i915/gem_userptr_blits: Only mlock the memfd once, not the arena
We multiply the memfd 64k to create a 2G arena which we then attempt to write into after marking read-only. However, when it comes to unlock the arena after the test, performance tanks as the kernel tries to resolve the 64k repeated mappings onto the same set of pages. (Must not be a very common operation!) We can get away with just mlocking the backing store to prevent its eviction, which should prevent the arena mapping from being freed as well. References: https://bugs.freedesktop.org/show_bug.cgi?id=108887 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Diffstat (limited to 'tests/i915/gem_userptr_blits.c')
-rw-r--r--tests/i915/gem_userptr_blits.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index 909dd19d..99049267 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -1104,7 +1104,7 @@ static void test_readonly(int i915)
/*
* We have only a 31bit delta which we use for generating
* the target address for MI_STORE_DWORD_IMM, so our maximum
- * usuable object size is only 2GiB. For now.
+ * usable object size is only 2GiB. For now.
*/
total = 2048ull << 20;
aperture_size = gem_aperture_size(i915) / 2;
@@ -1124,7 +1124,7 @@ static void test_readonly(int i915)
*(uint32_t *)(space + offset) = offset;
}
igt_assert_eq_u32(*(uint32_t *)pages, (uint32_t)(total - sz));
- igt_assert(mlock(space, total) == 0);
+ igt_assert(mlock(pages, sz) == 0);
close(memfd);
/* Check we can create a normal userptr bo wrapping the wrapper */
@@ -1176,6 +1176,7 @@ static void test_readonly(int i915)
}
igt_waitchildren();
+ munlock(pages, sz);
munmap(space, total);
munmap(pages, sz);
}