public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH 1/1] lib: consolidate duplicated define of vfs_file_max(void)
@ 2019-04-16 15:57 Caz Yokoyama
  2019-04-16 17:33 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [1/1] " Patchwork
  2019-04-17  8:12 ` [igt-dev] [PATCH 1/1] " Petri Latvala
  0 siblings, 2 replies; 5+ messages in thread
From: Caz Yokoyama @ 2019-04-16 15:57 UTC (permalink / raw)
  To: igt-dev

Signed-off-by: Caz Yokoyama <caz.yokoyama@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 lib/igt_aux.c               | 14 ++++++++++++++
 lib/igt_aux.h               |  2 ++
 lib/intel_os.c              | 14 --------------
 tests/i915/gem_exec_reuse.c | 14 +-------------
 4 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 05528352..ac33875e 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1615,3 +1615,17 @@ bool igt_allow_unlimited_files(void)
 	rlim.rlim_max = nofile_rlim;
 	return setrlimit(RLIMIT_NOFILE, &rlim) == 0;
 }
+
+uint64_t vfs_file_max(void)
+{
+	static long long unsigned max;
+	if (max == 0) {
+		FILE *file = fopen("/proc/sys/fs/file-max", "r");
+		max = 80000;
+		if (file) {
+			igt_assert(fscanf(file, "%llu", &max) == 1);
+			fclose(file);
+		}
+	}
+	return max;
+}
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 55392790..b5416ae0 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -297,4 +297,6 @@ void igt_lsof(const char *dpath);
 
 #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
 
+uint64_t vfs_file_max(void);
+
 #endif /* IGT_AUX_H */
diff --git a/lib/intel_os.c b/lib/intel_os.c
index dd93bea1..505831c0 100644
--- a/lib/intel_os.c
+++ b/lib/intel_os.c
@@ -279,20 +279,6 @@ void *intel_get_total_pinnable_mem(size_t *total)
 	return can_mlock;
 }
 
-static uint64_t vfs_file_max(void)
-{
-	static long long unsigned max;
-	if (max == 0) {
-		FILE *file = fopen("/proc/sys/fs/file-max", "r");
-		max = 80000;
-		if (file) {
-			igt_assert(fscanf(file, "%llu", &max) == 1);
-			fclose(file);
-		}
-	}
-	return max;
-}
-
 static unsigned max_open_files(void)
 {
 	struct rlimit rlim;
diff --git a/tests/i915/gem_exec_reuse.c b/tests/i915/gem_exec_reuse.c
index 9cba1354..935bfa9a 100644
--- a/tests/i915/gem_exec_reuse.c
+++ b/tests/i915/gem_exec_reuse.c
@@ -25,6 +25,7 @@
 #include <sys/resource.h>
 
 #include "igt.h"
+#include "igt_aux.h"
 
 IGT_TEST_DESCRIPTION("Inspect scaling with large number of reused objects");
 
@@ -56,19 +57,6 @@ static void noop(struct noop *n,
 	gem_execbuf(n->fd, &execbuf);
 }
 
-static uint64_t vfs_file_max(void)
-{
-	long long unsigned max = 80000;
-	FILE *file = fopen("/proc/sys/fs/file-max", "r");
-	if (file) {
-		igt_assert(fscanf(file, "%llu", &max) == 1);
-		fclose(file);
-	}
-
-	igt_info("System limit for open files is %llu\n", max);
-	return max;
-}
-
 static uint64_t max_open_files(void)
 {
 	struct rlimit rlim;
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-24 10:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-16 15:57 [igt-dev] [PATCH 1/1] lib: consolidate duplicated define of vfs_file_max(void) Caz Yokoyama
2019-04-16 17:33 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [1/1] " Patchwork
2019-04-17  8:12 ` [igt-dev] [PATCH 1/1] " Petri Latvala
2019-04-17 14:49   ` Caz Yokoyama
2019-04-24 10:19     ` Petri Latvala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox