[igt-dev] [PATCH i-g-t] lib: Use nr_open not file-max for setting fd rlimit

Chris Wilson chris at chris-wilson.co.uk
Mon Apr 8 21:36:02 UTC 2019


Petri pointed out that the maximum allowed number of files per process
is nr_open, not the system cap of file-max.

Suggested-by: Petri Latvala <petri.latvala at intel.com>
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Cc: Petri Latvala <petri.latvala at intel.com>
---
 lib/igt_aux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 266aa8321..02f4defb6 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1595,7 +1595,7 @@ bool igt_allow_unlimited_files(void)
 	struct rlimit rlim;
 	unsigned nofile_rlim = 1024*1024;
 
-	FILE *file = fopen("/proc/sys/fs/file-max", "r");
+	FILE *file = fopen("/proc/sys/fs/nr_open", "r");
 	if (file) {
 		igt_assert(fscanf(file, "%u", &nofile_rlim) == 1);
 		igt_info("System limit for open files is %u\n", nofile_rlim);
-- 
2.20.1



More information about the igt-dev mailing list