Whamcloud - gitweb
LU-17151 tests: increase memcg limit on x86_64 68/55568/7
authorQian Yingjin <qian@ddn.com>
Fri, 28 Jun 2024 02:41:47 +0000 (22:41 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 31 Jul 2024 16:07:42 +0000 (16:07 +0000)
The x86_64 memcg limit of 384MB is quite small, often resulting in
failures on sanity/test_411b in some exterme situations when test
in VM environments.

To avoid the failures, we increase the limit with 1024MiB on both
x86_64 and arm systems.

And we also skip the test if the available OST storage space are
not enough.

Test-Parameters: trivial testlist=sanity env=ONLY=411b,ONLY_REPEAT=100
Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: I1064a4c2523b8d3e721f9712c17b829a9b1796dc
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55568
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity.sh

index 043fc8b..3fd123f 100755 (executable)
@@ -29631,15 +29631,23 @@ test_411b() {
        # LU-9966
        [ -e "$cg_basedir/memory.kmem.limit_in_bytes" ] ||
                skip "no setup for cgroup"
-       $LFS setstripe -c 2 $DIR/$tfile || error "unable to setstripe"
-       # (x86) testing suggests we can't reliably avoid OOM with a 64M-256M
-       # limit, so we have 384M in cgroup
-       # (arm) this seems to hit OOM more often than x86, so 1024M
-       if [[ $(uname -m) = aarch64 ]]; then
-               local memlimit_mb=1024
-       else
-               local memlimit_mb=384
-       fi
+
+       local count=2
+
+       (( OSTCOUNT < 2 )) && count=$OSTCOUNT
+       $LFS setstripe -c $count $DIR/$tfile || error "unable to setstripe"
+
+       # To avoid testing failures on x86 and arm, we set the memcg limit
+       # with 1024M on both systems.
+       local memlimit_mb=1024
+       local min_size_ost=$($LFS df | awk "/$FSNAME-OST/ { print \$4 }" |
+                            sort -un | head -1)
+
+       (( memlimit_mb * 4 * 1024 < min_size_ost * count - 100 )) ||
+               skip "OST space are too small: ${min_size_ost}K"
+
+       echo "count=$count/$OSTCOUNT min_size_ost=${min_size_ost}K"
+       $LFS df
 
        # Create a cgroup and set memory limit
        # (tfile is used as an easy way to get a recognizable cgroup name)
@@ -29657,7 +29665,7 @@ test_411b() {
        cancel_lru_locks osc
 
        rm -f $DIR/$tfile
-       $LFS setstripe -c 2 $DIR/$tfile || error "unable to setstripe"
+       $LFS setstripe -c $count $DIR/$tfile || error "unable to setstripe"
 
        # Try writing at a larger block size
        # NB: if block size is >= 1/2 cgroup size, we sometimes get OOM killed
@@ -29670,9 +29678,13 @@ test_411b() {
        sync
        cancel_lru_locks osc
        rm -f $DIR/$tfile
-       $LFS setstripe -c 2 $DIR/$tfile.{1..4} || error "unable to setstripe"
+
+       $LFS setstripe -c $count $DIR/$tfile.{1..4} || error "unable to setstripe"
 
        # Try writing multiple files at once
+       (( memlimit_mb * 4 * 1024 * 2 < min_size_ost * count - 100 )) ||
+               skip "OST space are too small: ${min_size_ost}K"
+
        echo "writing multiple files"
        bash -c "echo \$$ > $cgdir/tasks && dd if=/dev/zero of=$DIR/$tfile.1 bs=32M count=$((memlimit_mb * 4 / 64))" &
        local pid1=$!