summaryrefslogtreecommitdiff
path: root/tests/i915/i915_suspend.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-02-19 22:17:45 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2019-02-28 21:06:49 +0000
commit6be2dc8ddfa332d129149aa3b13db14fa2cd6c0a (patch)
tree732ce1f224a22f059f26c0c2a2de78bf518c8a6c /tests/i915/i915_suspend.c
parent0f0db14e7f4ec41251ca156d7cb5b8d531a38006 (diff)
lib: Incrementally mlock()
As we already have the previous portion of the mmap mlocked, we only need to mlock() the fresh portion for testing available memory. v2: Fixup the uint64_t pointer arithmetric and only use a single mmap to avoid subsequent mlock fail (for reasons unknown, but bet on mm/). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Caz Yokoyama <Caz.Yokoyama@intel.com> Reviewed-by: Caz Yokoyama <Caz.Yokoyama@intel.com>
Diffstat (limited to 'tests/i915/i915_suspend.c')
-rw-r--r--tests/i915/i915_suspend.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/tests/i915/i915_suspend.c b/tests/i915/i915_suspend.c
index 84cb3b49..cd7cf967 100644
--- a/tests/i915/i915_suspend.c
+++ b/tests/i915/i915_suspend.c
@@ -163,25 +163,14 @@ test_sysfs_reader(bool hibernate)
static void
test_shrink(int fd, unsigned int mode)
{
- void *mem;
size_t size;
+ void *mem;
gem_quiescent_gpu(fd);
intel_purge_vm_caches(fd);
- size = intel_get_total_pinnable_mem();
- igt_require(size > 64 << 20);
- size -= 64 << 20;
-
- mem = mmap(NULL, size, PROT_READ, MAP_SHARED | MAP_ANON, -1, 0);
-
- intel_purge_vm_caches(fd);
-
- igt_debug("Locking %'zu B (%'zu MiB)\n",
- size, size >> 20);
- igt_assert(!mlock(mem, size));
- igt_info("Locked %'zu B (%'zu MiB)\n",
- size, size >> 20);
+ mem = intel_get_total_pinnable_mem(&size);
+ igt_assert(mem != MAP_FAILED);
intel_purge_vm_caches(fd);
igt_system_suspend_autoresume(mode, SUSPEND_TEST_NONE);