[1/1] memcg/stress: Lower swap memory use
diff mbox series

Message ID 20200117063600.3451-1-pvorel@suse.cz
State New
Headers show
Series
  • [1/1] memcg/stress: Lower swap memory use
Related show

Commit Message

Petr Vorel Jan. 17, 2020, 6:36 a.m. UTC
Fix freeze on systems, where where swap size is more
or less equal to a system RAM.

Fixes: #632

Reported-by: Zuo Liu <lz843723683@gmail.com>
Tested-by: Zuo Liu <lz843723683@gmail.com>
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Li Wang Jan. 19, 2020, 8:33 a.m. UTC | #1
Ack.

On Fri, Jan 17, 2020, 07:36 Petr Vorel <pvorel@suse.cz> wrote:

> Fix freeze on systems, where where swap size is more
> or less equal to a system RAM.
>
> Fixes: #632
>
> Reported-by: Zuo Liu <lz843723683@gmail.com>
> Tested-by: Zuo Liu <lz843723683@gmail.com>
> Suggested-by: Cyril Hrubis <chrubis@suse.cz>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git
> a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
> b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
> index ad8605e16..a48d21e6e 100755
> --- a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
> +++ b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
> @@ -33,7 +33,7 @@ setup()
>         local swap_free=`cat /proc/meminfo | grep SwapFree | awk '{ print
> $2 }'`
>         local pgsize=`tst_getconf PAGESIZE`
>
> -       MEM=$(( $mem_free + $swap_free / 2 ))
> +       MEM=$(( $mem_free + $swap_free / 1O ))
>         MEM=$(( $MEM / 1024 ))
>         RUN_TIME=$(( 15 * 60 ))
>         [ "$pgsize" = "4096" ] && THREAD_SPARE_MB=1 || THREAD_SPARE_MB=8
> --
> 2.24.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
>
Cyril Hrubis Jan. 21, 2020, 2:14 p.m. UTC | #2
Hi!
> Fix freeze on systems, where where swap size is more
> or less equal to a system RAM.
> 
> Fixes: #632
> 
> Reported-by: Zuo Liu <lz843723683@gmail.com>
> Tested-by: Zuo Liu <lz843723683@gmail.com>
> Suggested-by: Cyril Hrubis <chrubis@suse.cz>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
> index ad8605e16..a48d21e6e 100755
> --- a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
> +++ b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
> @@ -33,7 +33,7 @@ setup()
>  	local swap_free=`cat /proc/meminfo | grep SwapFree | awk '{ print $2 }'`
>  	local pgsize=`tst_getconf PAGESIZE`
>  
> -	MEM=$(( $mem_free + $swap_free / 2 ))
> +	MEM=$(( $mem_free + $swap_free / 1O ))

I wonder if we can be a bit smarter about this. Maybe we should add some
percentage of RAM if enough swap is present.

Patch
diff mbox series

diff --git a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
index ad8605e16..a48d21e6e 100755
--- a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
+++ b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
@@ -33,7 +33,7 @@  setup()
 	local swap_free=`cat /proc/meminfo | grep SwapFree | awk '{ print $2 }'`
 	local pgsize=`tst_getconf PAGESIZE`
 
-	MEM=$(( $mem_free + $swap_free / 2 ))
+	MEM=$(( $mem_free + $swap_free / 1O ))
 	MEM=$(( $MEM / 1024 ))
 	RUN_TIME=$(( 15 * 60 ))
 	[ "$pgsize" = "4096" ] && THREAD_SPARE_MB=1 || THREAD_SPARE_MB=8