diff options
| author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-01-06 09:59:47 +0000 |
|---|---|---|
| committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-01-06 10:07:31 +0000 |
| commit | 25cf0551c7d210c8c085c109891dc97a2cc61e27 (patch) | |
| tree | d38c33934e7c8a04c21befcab079b4a4fdaa5fc9 /tests | |
| parent | eaa1e8e127205a9517bfc89275cd8723e8b09ed2 (diff) | |
igt/gem_ctx_thrash: Tweak resource limits
On some systems (ok, most systems!) we may need to enlarge the allowed
number of open files in order to create enough fd to fill the aperture.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87572
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gem_ctx_thrash.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/gem_ctx_thrash.c b/tests/gem_ctx_thrash.c index f9f6faa4..5c272338 100644 --- a/tests/gem_ctx_thrash.c +++ b/tests/gem_ctx_thrash.c @@ -28,6 +28,7 @@ #include <pthread.h> #include <fcntl.h> #include <sys/stat.h> +#include <sys/resource.h> #include "ioctl_wrappers.h" #include "igt_aux.h" @@ -140,6 +141,7 @@ processes(void) { int *all_fds; uint64_t aperture; + struct rlimit rlim; int ppgtt_mode; int ctx_size; int obj_size; @@ -165,6 +167,16 @@ processes(void) igt_info("Creating %d contexts (assuming of size %d)\n", num_ctx, ctx_size); intel_require_memory(num_ctx, ctx_size, CHECK_RAM | CHECK_SWAP); + + /* tweak rlimits to allow us to create this many files */ + igt_assert(getrlimit(RLIMIT_NOFILE, &rlim) == 0); + if (rlim.rlim_cur < ALIGN(num_ctx + 1024, 1024)) { + rlim.rlim_cur = ALIGN(num_ctx + 1024, 1024); + if (rlim.rlim_cur > rlim.rlim_max) + rlim.rlim_max = rlim.rlim_cur; + igt_assert(setrlimit(RLIMIT_NOFILE, &rlim) == 0); + } + all_fds = malloc(num_ctx * sizeof(int)); igt_assert(all_fds); for (n = 0; n < num_ctx; n++) { |
