[DTrace-devel] [PATCH v2] test: Bump up locked memory in lockmem tests further

Kris Van Hees kris.van.hees at oracle.com
Tue Nov 8 05:49:36 UTC 2022


R-b as added below, wiwth small change as indicated.

On Mon, Nov 07, 2022 at 11:31:03PM -0500, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> In a previous commit --
> 672c4532 "test: Bump up locked memory in lockmem tests"
> -- the lockmem tests bumped up the locked-memory limit for cases where
> DTrace is expected to load successfully.  That patch helped the tests
> pass under wider conditions, but further increases are warranted.

>From there ...

> As previously noted, the default aggsize is 4M.  This is the dominant
> drain on locked memory for a simple script like "BEGIN { @ = avg(1) }".
> 
> Meanwhile, the model used in gmap_create_aggs() for computing nelems
>     DTRACEOPT_AGGSIZE / (dt_maxtuplesize + dt_maxaggdsize)
> is approximate.  The actual amount allocated by BPF can be several
> factors larger.
> 
> Further, this allocation is made on each CPU.

... to here, is unnecessary commentary that brings in details that are not
actually relevant to this patch.  The patch simply needs a high enough value
to pretty much guarantee that the allocation will be successful.  Beyond that,
nothing really matters here.  So, just remove that from the commit message.

> Increase the lockmem limit for cases expecting successful loads.
> Specifically, use 256G, as runtest.sh does for "ulimit -l".
> 
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>

> ---
>  test/unittest/misc/tst.lockmem-cmdline.sh | 3 ++-
>  test/unittest/misc/tst.lockmem-envvar.r   | 3 +++
>  test/unittest/misc/tst.lockmem-envvar.sh  | 3 ++-
>  test/unittest/misc/tst.lockmem-pragma.r   | 3 +++
>  test/unittest/misc/tst.lockmem-pragma.sh  | 3 ++-
>  test/unittest/misc/tst.lockmem-x.r        | 3 +++
>  test/unittest/misc/tst.lockmem-x.sh       | 3 ++-
>  7 files changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/test/unittest/misc/tst.lockmem-cmdline.sh b/test/unittest/misc/tst.lockmem-cmdline.sh
> index 64b5096c..90334bae 100755
> --- a/test/unittest/misc/tst.lockmem-cmdline.sh
> +++ b/test/unittest/misc/tst.lockmem-cmdline.sh
> @@ -5,10 +5,11 @@
>  # Licensed under the Universal Permissive License v 1.0 as shown at
>  # http://oss.oracle.com/licenses/upl.
>  #
> +# @@nosort
>  
>  dtrace=$1
>  
> -for val in 1 262144 unlimited; do
> +for val in 1 268435456 unlimited; do
>  	ulimit -l $val
>  
>  	$dtrace -qn 'BEGIN { @ = avg(1234); exit(0); }'
> diff --git a/test/unittest/misc/tst.lockmem-envvar.r b/test/unittest/misc/tst.lockmem-envvar.r
> index 1e6918e7..29917922 100644
> --- a/test/unittest/misc/tst.lockmem-envvar.r
> +++ b/test/unittest/misc/tst.lockmem-envvar.r
> @@ -9,6 +9,9 @@
>  
>               1234
>  0
> +
> +             1234
> +0
>  -- @@stderr --
>  dtrace: could not enable tracing: failed to create BPF map 'state':
>  	The kernel locked-memory limit is possibly too low.  Set a
> diff --git a/test/unittest/misc/tst.lockmem-envvar.sh b/test/unittest/misc/tst.lockmem-envvar.sh
> index 735516d0..05dcedc3 100755
> --- a/test/unittest/misc/tst.lockmem-envvar.sh
> +++ b/test/unittest/misc/tst.lockmem-envvar.sh
> @@ -5,12 +5,13 @@
>  # Licensed under the Universal Permissive License v 1.0 as shown at
>  # http://oss.oracle.com/licenses/upl.
>  #
> +# @@nosort
>  
>  dtrace=$1
>  
>  ulimit -l 1
>  
> -for val in 16 1K 262144K 256M unlimited; do
> +for val in 16 1K 268435456K 262144M 256G unlimited; do
>  	DTRACE_OPT_LOCKMEM=$val $dtrace -qn 'BEGIN { @ = avg(1234); exit(0); }'
>  	echo $?
>  done
> diff --git a/test/unittest/misc/tst.lockmem-pragma.r b/test/unittest/misc/tst.lockmem-pragma.r
> index 1e6918e7..29917922 100644
> --- a/test/unittest/misc/tst.lockmem-pragma.r
> +++ b/test/unittest/misc/tst.lockmem-pragma.r
> @@ -9,6 +9,9 @@
>  
>               1234
>  0
> +
> +             1234
> +0
>  -- @@stderr --
>  dtrace: could not enable tracing: failed to create BPF map 'state':
>  	The kernel locked-memory limit is possibly too low.  Set a
> diff --git a/test/unittest/misc/tst.lockmem-pragma.sh b/test/unittest/misc/tst.lockmem-pragma.sh
> index 03aacaf5..74d0ed15 100755
> --- a/test/unittest/misc/tst.lockmem-pragma.sh
> +++ b/test/unittest/misc/tst.lockmem-pragma.sh
> @@ -5,12 +5,13 @@
>  # Licensed under the Universal Permissive License v 1.0 as shown at
>  # http://oss.oracle.com/licenses/upl.
>  #
> +# @@nosort
>  
>  dtrace=$1
>  
>  ulimit -l 1
>  
> -for val in 16 1K 262144K 256M unlimited; do
> +for val in 16 1K 268435456K 262144M 256G unlimited; do
>  	$dtrace -qs /dev/stdin << EOF
>  		#pragma D option lockmem=$val
>  
> diff --git a/test/unittest/misc/tst.lockmem-x.r b/test/unittest/misc/tst.lockmem-x.r
> index 1e6918e7..29917922 100644
> --- a/test/unittest/misc/tst.lockmem-x.r
> +++ b/test/unittest/misc/tst.lockmem-x.r
> @@ -9,6 +9,9 @@
>  
>               1234
>  0
> +
> +             1234
> +0
>  -- @@stderr --
>  dtrace: could not enable tracing: failed to create BPF map 'state':
>  	The kernel locked-memory limit is possibly too low.  Set a
> diff --git a/test/unittest/misc/tst.lockmem-x.sh b/test/unittest/misc/tst.lockmem-x.sh
> index b70bd285..ea8f5f3f 100755
> --- a/test/unittest/misc/tst.lockmem-x.sh
> +++ b/test/unittest/misc/tst.lockmem-x.sh
> @@ -5,12 +5,13 @@
>  # Licensed under the Universal Permissive License v 1.0 as shown at
>  # http://oss.oracle.com/licenses/upl.
>  #
> +# @@nosort
>  
>  dtrace=$1
>  
>  ulimit -l 1
>  
> -for val in 16 1K 262144K 256M unlimited; do
> +for val in 16 1K 268435456K 262144M 256G unlimited; do
>  	$dtrace -xlockmem=$val -qn 'BEGIN { @ = avg(1234); exit(0); }'
>  	echo $?
>  done
> -- 
> 2.18.4
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list