fstests: don't oom the box opening tmpfiles (take 2)

For the t_open_tmpfiles tests that run multiple jobs in parallel,
limit ourselves to half of file-max for all jobs combined,
so that we don't OOM the test machine.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Amir Goldstein
2019-06-09 20:12:29 +03:00
committed by Eryu Guan
parent 2b42b7e164
commit c42c8e6c2a
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -41,10 +41,10 @@ _scratch_mount
# Try to load up all the CPUs, two threads per CPU.
nr_cpus=$(( $(getconf _NPROCESSORS_ONLN) * 2 ))
# Set ULIMIT_NOFILE to min(file-max / 2, 50000 files per LOAD_FACTOR)
# Set ULIMIT_NOFILE to min(file-max / $nr_cpus / 2, 50000 files per LOAD_FACTOR)
# so that this test doesn't take forever or OOM the box
max_files=$((50000 * LOAD_FACTOR))
max_allowable_files=$(( $(cat /proc/sys/fs/file-max) / 2 ))
max_allowable_files=$(( $(cat /proc/sys/fs/file-max) / $nr_cpus / 2 ))
test $max_allowable_files -gt 0 && test $max_files -gt $max_allowable_files && \
max_files=$max_allowable_files
ulimit -n $max_files
+2 -2
View File
@@ -43,10 +43,10 @@ _scratch_mount
# Load up all the CPUs, two threads per CPU.
nr_cpus=$(( $(getconf _NPROCESSORS_ONLN) * 2 ))
# Set ULIMIT_NOFILE to min(file-max / 2, 30000 files per cpu per LOAD_FACTOR)
# Set ULIMIT_NOFILE to min(file-max / $nr_cpus / 2, 30000 files per cpu per LOAD_FACTOR)
# so that this test doesn't take forever or OOM the box
max_files=$((30000 * LOAD_FACTOR))
max_allowable_files=$(( $(cat /proc/sys/fs/file-max) / 2 ))
max_allowable_files=$(( $(cat /proc/sys/fs/file-max) / $nr_cpus / 2 ))
test $max_allowable_files -gt 0 && test $max_files -gt $max_allowable_files && \
max_files=$max_allowable_files
ulimit -n $max_files