From a26b49279c86a08e84215698d5bbc3d1ebf4d939 Mon Sep 17 00:00:00 2001 From: Qian Yingjin Date: Thu, 27 Jun 2024 22:41:47 -0400 Subject: [PATCH] LU-17151 tests: increase memcg limit on x86_64 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 Change-Id: I1064a4c2523b8d3e721f9712c17b829a9b1796dc Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55568 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- lustre/tests/sanity.sh | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 043fc8b..3fd123f 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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=$! -- 1.8.3.1