Re: git: c7bc30c24f86 - main - stress2: Some tests use hw.ncpu to scale the load. Tests on a box with a large number of CPUs show that this number needs to be capped

From: Ronald Klop <ronald-lists_at_klop.ws>
Date: Sat, 17 Aug 2024 08:38:43 UTC
Interesting. Why the cap?
Can you explain what happened in the tests?

Regards,
Ronald.

Van: Peter Holm <pho@FreeBSD.org>
Datum: 17 augustus 2024 08:38
Aan: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Onderwerp: git: c7bc30c24f86 - main - stress2: Some tests use hw.ncpu  to scale the load. Tests on a box with a large number of CPUs  show that this number needs to be capped

> 
> 
> The branch main has been updated by pho:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=c7bc30c24f8625c6e9ef41be427fa26c6eb3d2bf
> 
> commit c7bc30c24f8625c6e9ef41be427fa26c6eb3d2bf
> Author:     Peter Holm 
> AuthorDate: 2024-08-17 06:37:34 +0000
> Commit:     Peter Holm 
> CommitDate: 2024-08-17 06:37:34 +0000
> 
>     stress2: Some tests use hw.ncpu to scale the load. Tests on a box with
>     a large number of CPUs show that this number needs to be capped
> ---
>  tools/test/stress2/misc/buildkernel.sh  | 1 +
>  tools/test/stress2/misc/buildworld.sh   | 1 +
>  tools/test/stress2/misc/buildworld2.sh  | 1 +
>  tools/test/stress2/misc/buildworld3.sh  | 1 +
>  tools/test/stress2/misc/buildworld4.sh  | 1 +
>  tools/test/stress2/misc/crossmp3.sh     | 1 +
>  tools/test/stress2/misc/crossmp4.sh     | 1 +
>  tools/test/stress2/misc/crossmp5.sh     | 1 +
>  tools/test/stress2/misc/crossmp8.sh     | 1 +
>  tools/test/stress2/misc/gnop4.sh        | 3 +++
>  tools/test/stress2/misc/tmpfs13.sh      | 1 +
>  tools/test/stress2/misc/zzbuildworld.sh | 1 +
>  12 files changed, 14 insertions(+)
> 
> diff --git a/tools/test/stress2/misc/buildkernel.sh b/tools/test/stress2/misc/buildkernel.sh
> index 849a09b81439..e0aa85617f9b 100755
> --- a/tools/test/stress2/misc/buildkernel.sh
> +++ b/tools/test/stress2/misc/buildkernel.sh
> @@ -49,6 +49,7 @@ chmod 0777 $TMPDIR
>  log=$mntpoint/log
>  
>  p=$((`sysctl -n hw.ncpu`+ 1))
> +[ $p -gt 32 ] && p=32  # Arbitrary cap
>  p=`jot -r 1 1 $p`
>  echo "make -j $p buildkernel KERNCONF=GENERIC DESTDIR=$mntpoint" 
>      "TARGET=amd64 TARGET_ARCH=amd64"
> diff --git a/tools/test/stress2/misc/buildworld.sh b/tools/test/stress2/misc/buildworld.sh
> index 595b387c90ae..3b362ec7041a 100755
> --- a/tools/test/stress2/misc/buildworld.sh
> +++ b/tools/test/stress2/misc/buildworld.sh
> @@ -55,6 +55,7 @@ mkdir $TMPDIR
>  chmod 0777 $TMPDIR
>  
>  p=$((`sysctl -n hw.ncpu`+ 1))
> +[ $p -gt 32 ] && p=32  # Arbitrary cap
>  timeout 20m make -i -j $p buildworld  DESTDIR=$mntpoint TARGET=amd64 
>      TARGET_ARCH=amd64 > /dev/null
>  
> diff --git a/tools/test/stress2/misc/buildworld2.sh b/tools/test/stress2/misc/buildworld2.sh
> index 9c1eed97b7ea..3653cb1db5b4 100755
> --- a/tools/test/stress2/misc/buildworld2.sh
> +++ b/tools/test/stress2/misc/buildworld2.sh
> @@ -46,6 +46,7 @@ mkdir $TMPDIR
>  chmod 0777 $TMPDIR
>  
>  p=$((`sysctl -n hw.ncpu`+ 1))
> +[ $p -gt 32 ] && p=32  # Arbitrary cap
>  make -j $p buildworld  DESTDIR=$mntpoint TARGET=amd64 TARGET_ARCH=amd64 
>      > /dev/null &
>  sleep $((20 *  60))
> diff --git a/tools/test/stress2/misc/buildworld3.sh b/tools/test/stress2/misc/buildworld3.sh
> index 0c660cae8eae..e3bce2764c0c 100755
> --- a/tools/test/stress2/misc/buildworld3.sh
> +++ b/tools/test/stress2/misc/buildworld3.sh
> @@ -62,6 +62,7 @@ mkdir $TMPDIR $MAKEOBJDIRPREFIX
>  chmod 0777 $TMPDIR $MAKEOBJDIRPREFIX
>  
>  p=$((`sysctl -n hw.ncpu`+ 1))
> +[ $p -gt 32 ] && p=32  # Arbitrary cap
>  su $testuser -c 
>      "make -i -j $p buildworld  DESTDIR=$mntpoint TARGET=amd64 
>      TARGET_ARCH=amd64 > /dev/null" &
> diff --git a/tools/test/stress2/misc/buildworld4.sh b/tools/test/stress2/misc/buildworld4.sh
> index 6c15a72a9dcb..d1d162120952 100755
> --- a/tools/test/stress2/misc/buildworld4.sh
> +++ b/tools/test/stress2/misc/buildworld4.sh
> @@ -50,6 +50,7 @@ mkdir $TMPDIR
>  chmod 0777 $TMPDIR
>  
>  p=$((`sysctl -n hw.ncpu`+ 1))
> +[ $p -gt 16 ] && p=16  # Arbitrary cap
>  [ `sysctl -n vm.swap_total` -gt 0 ] && p=$((p * 4))
>  p=`jot -r 1 1 $p`
>  echo "make -i -j $p buildworld  DESTDIR=$mntpoint TARGET=amd64 "
> diff --git a/tools/test/stress2/misc/crossmp3.sh b/tools/test/stress2/misc/crossmp3.sh
> index 5eecb936e900..32c625a1e4ad 100755
> --- a/tools/test/stress2/misc/crossmp3.sh
> +++ b/tools/test/stress2/misc/crossmp3.sh
> @@ -41,6 +41,7 @@
>  CONT=/tmp/crossmp3.continue
>  if [ $# -eq 0 ]; then
>     N=`sysctl -n hw.ncpu`
> +   [ $N -gt 32 ] && N=32  # Arbitrary cap
>     usermem=`sysctl -n hw.usermem`
>     [ `sysctl -n vm.swap_total` -eq 0 ] && usermem=$((usermem / 2))
>     size=$((usermem / 1024 / 1024 / N))
> diff --git a/tools/test/stress2/misc/crossmp4.sh b/tools/test/stress2/misc/crossmp4.sh
> index e22f969b72bb..21d22bee69e5 100755
> --- a/tools/test/stress2/misc/crossmp4.sh
> +++ b/tools/test/stress2/misc/crossmp4.sh
> @@ -40,6 +40,7 @@
>  . ../default.cfg
>  
>  N=`sysctl -n hw.ncpu`
> +[ $N -gt 32 ] && N=32  # Arbitrary cap
>  usermem=`sysctl -n hw.usermem`
>  [ `swapinfo | wc -l` -eq 1 ] && usermem=$((usermem/100*80))
>  size=$((usermem / 1024 / 1024 - 2))
> diff --git a/tools/test/stress2/misc/crossmp5.sh b/tools/test/stress2/misc/crossmp5.sh
> index 038dea7ebe4f..6e504d9f20ad 100755
> --- a/tools/test/stress2/misc/crossmp5.sh
> +++ b/tools/test/stress2/misc/crossmp5.sh
> @@ -33,6 +33,7 @@
>  . ../default.cfg
>  
>  N=`sysctl -n hw.ncpu`
> +[ $N -gt 32 ] && N=32  # Arbitrary cap
>  usermem=`sysctl -n hw.usermem`
>  [ `swapinfo | wc -l` -eq 1 ] && usermem=$((usermem/100*80))
>  size=$((usermem / 1024 / 1024 / N))
> diff --git a/tools/test/stress2/misc/crossmp8.sh b/tools/test/stress2/misc/crossmp8.sh
> index e877dfaf6d1c..eec5ba9bc7c1 100755
> --- a/tools/test/stress2/misc/crossmp8.sh
> +++ b/tools/test/stress2/misc/crossmp8.sh
> @@ -41,6 +41,7 @@
>  
>  CONT=/tmp/crossmp8.continue
>  N=`sysctl -n hw.ncpu`
> +[ $N -gt 32 ] && N=32  # Arbitrary cap
>  usermem=`sysctl -n hw.usermem`
>  [ `swapinfo | wc -l` -eq 1 ] && usermem=$((usermem/100*80))
>  size=$((usermem / 1024 / 1024 / N))
> diff --git a/tools/test/stress2/misc/gnop4.sh b/tools/test/stress2/misc/gnop4.sh
> index f938dd3b790b..1b4da74266f6 100755
> --- a/tools/test/stress2/misc/gnop4.sh
> +++ b/tools/test/stress2/misc/gnop4.sh
> @@ -34,6 +34,8 @@
>  # https://people.freebsd.org/~pho/stress/log/kostik1017.txt
>  # Fixed by r322175
>  
> +# Seen with p=513: Threads stuck in "ffsrca"
> +
>  . ../default.cfg
>  
>  gigs=9
> @@ -62,6 +64,7 @@ cd $mntpoint/src
>  export MAKEOBJDIRPREFIX=$mntpoint/obj
>  
>  p=$((`sysctl -n hw.ncpu`+ 1))
> +[ $p -gt 32 ] && p=32  # Temporary work around
>  timeout 10m 
>      make -i -j $p buildworld  DESTDIR=$mntpoint TARGET=amd64 
>      TARGET_ARCH=amd64 > /dev/null
> diff --git a/tools/test/stress2/misc/tmpfs13.sh b/tools/test/stress2/misc/tmpfs13.sh
> index 29b44cbc9ad4..231c42033f9d 100755
> --- a/tools/test/stress2/misc/tmpfs13.sh
> +++ b/tools/test/stress2/misc/tmpfs13.sh
> @@ -40,6 +40,7 @@
>  . ../default.cfg
>  
>  N=`sysctl -n hw.ncpu`
> +[ $N -gt 32 ] && N=32  # Arbitrary cap
>  usermem=`sysctl -n hw.usermem`
>  [ `swapinfo | wc -l` -eq 1 ] && usermem=$((usermem/100*80))
>  size=$((usermem / 1024 / 1024 / 2))
> diff --git a/tools/test/stress2/misc/zzbuildworld.sh b/tools/test/stress2/misc/zzbuildworld.sh
> index 2104eb156c86..e1bf867d8d5f 100755
> --- a/tools/test/stress2/misc/zzbuildworld.sh
> +++ b/tools/test/stress2/misc/zzbuildworld.sh
> @@ -44,6 +44,7 @@ top=$mntpoint
>  export MAKEOBJDIRPREFIX=$top/obj
>  export log=$top/buildworld.`date +%Y%m%dT%H%M`
>  n=$((`sysctl -n hw.ncpu` + 1))
> +[ $n -gt 32 ] && n=32  # Arbitrary cap
>  cd $src
>  make -j$n buildworld > $log 2>&1 && s=0 ||s=1
>  grep  '***' $log && s=2
> 
> 
> 
> 
>