xfs/502: scale file count based on AG count to avoid thrashing
authorBrian Foster <bfoster@redhat.com>
Fri, 9 Apr 2021 19:08:34 +0000 (15:08 -0400)
committerEryu Guan <guaneryu@gmail.com>
Sun, 11 Apr 2021 09:10:55 +0000 (17:10 +0800)
xfs/502 currently creates a default of 30k unlinked files per CPU.
While this completes in a reasonable amount of time on systems with
lesser numbers of CPUs, this scales poorly on high CPU count systems
that are otherwise testing smaller default filesystems. For example,
on an 80xcpu box and a 15GB (4 AG) XFS filesystem, xfs/502 requires
3 hours to complete. The same test on a 4xcpu vm (or the 80xcpu
hardware with an 80AG filesystem instead of the default of 4AGs)
completes in a little over 5 minutes. This is a rather severe
thrashing breakdown that doesn't add much value to the test
coverage.

Address this problem by scaling the file count to the AG count of
the filesystem rather than the CPU count of the test system. Since
the AG count is likely to be less than the CPU count, bump the
default scaling factor a bit from 30k per CPU to 50k per AG. From
there, larger counts can still be exercised via the global load
factor configuration.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/xfs/502

index 337ae07e9153a90d9100d326f961ef968be63587..202bfbc627f77bbc955f251a86dcffe4a6d2a2aa 100755 (executable)
@@ -28,6 +28,7 @@ _cleanup()
 # get standard environment, filters and checks
 . ./common/rc
 . ./common/inject
+. ./common/filter
 
 # real QA test starts here
 _supported_fs xfs
@@ -36,15 +37,21 @@ _require_scratch
 _require_test_program "t_open_tmpfiles"
 
 rm -f $seqres.full
-_scratch_mkfs >> $seqres.full 2>&1
+
+_scratch_mkfs | _filter_mkfs 2> $tmp.mkfs > /dev/null
+cat $tmp.mkfs >> $seqres.full
+. $tmp.mkfs
+
 _scratch_mount
 
 # Load up all the CPUs, two threads per CPU.
 nr_cpus=$(( $(getconf _NPROCESSORS_ONLN) * 2 ))
 
-# Set ULIMIT_NOFILE to min(file-max / $nr_cpus / 2, 30000 files per cpu per LOAD_FACTOR)
+# Set ULIMIT_NOFILE to min(file-max / $nr_cpus / 2, 50000 files per AG per LOAD_FACTOR)
 # so that this test doesn't take forever or OOM the box
-max_files=$((30000 * LOAD_FACTOR))
+max_files=$((50000 * agcount * LOAD_FACTOR))
+max_files=$((max_files / $nr_cpus))
+
 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