<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0"></p>
<div>Hi<br>
<br>
On 29/01/2019 17:50, Petr Vorel wrote:> Hi Cristian,<br>
> <br>
> I suggest following cleanup of your patch (see bellow).<br>
> <br>
> This change, with my other cleanup patch [1] + your patch [2] can be seen on [3].<br>
> <br>
> Kind regards,<br>
> Petr</div>
<div><br>
Thanks for the review and the cleanup. (next I was going to rework following your today's advises, but you've been faster...)<br>
<br>
I'll test asap.<br>
<br>
Thanks<br>
<br>
Regards<br>
<br>
Cristian</div>
<br>
<p></p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Petr Vorel <pvorel@suse.cz><br>
<b>Sent:</b> 29 January 2019 17:50:19<br>
<b>To:</b> Cristian Marussi<br>
<b>Cc:</b> ltp@lists.linux.it<br>
<b>Subject:</b> Re: [LTP] [PATCH v3] memcg_stress_test.sh: ported to newlib</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi Cristian,<br>
<br>
I suggest following cleanup of your patch (see bellow).<br>
<br>
This change, with my other cleanup patch [1] + your patch [2] can be seen on [3].<br>
<br>
Kind regards,<br>
Petr<br>
<br>
[1] <a href="https://patchwork.ozlabs.org/patch/1032923/">https://patchwork.ozlabs.org/patch/1032923/</a><br>
[2] <a href="https://patchwork.ozlabs.org/patch/1020887/">https://patchwork.ozlabs.org/patch/1020887/</a><br>
[3] <a href="https://github.com/pevik/ltp/commits/christian/memcg_stress_test.sh.v3.fixes">
https://github.com/pevik/ltp/commits/christian/memcg_stress_test.sh.v3.fixes</a><br>
<br>
diff --git testcases/kernel/controllers/cgroup_lib.sh testcases/kernel/controllers/cgroup_lib.sh<br>
index c164932fa..7918b5636 100644<br>
--- testcases/kernel/controllers/cgroup_lib.sh<br>
+++ testcases/kernel/controllers/cgroup_lib.sh<br>
@@ -33,7 +33,7 @@ is_cgroup_subsystem_available_and_enabled()<br>
[ $# -eq 0 ] && tst_brk TBROK "is_cgroup_subsystem_available_and_enabled: subsystem not defined"<br>
<br>
val=$(grep -w $subsystem /proc/cgroups | awk '{ print $4 }')<br>
- [ "x$val" = "x1" ] && return 0<br>
+ [ "$val" = "1" ] && return 0<br>
<br>
return 1<br>
}<br>
diff --git testcases/kernel/controllers/memcg/stress/Makefile testcases/kernel/controllers/memcg/stress/Makefile<br>
index 773363cfc..a9678bf3b 100644<br>
--- testcases/kernel/controllers/memcg/stress/Makefile<br>
+++ testcases/kernel/controllers/memcg/stress/Makefile<br>
@@ -1,9 +1,6 @@<br>
# SPDX-License-Identifier: GPL-2.0-or-later<br>
# Copyright (C) 2009, Cisco Systems Inc.<br>
# Author: Ngie Cooper, September 2009<br>
-#<br>
-# kernel/controllers/memcg/stress testcase suite Makefile.<br>
-#<br>
<br>
top_srcdir ?= ../../../../..<br>
<br>
diff --git testcases/kernel/controllers/memcg/stress/memcg_process_stress.c testcases/kernel/controllers/memcg/stress/memcg_process_stress.c<br>
index 6af550012..422deaeee 100644<br>
--- testcases/kernel/controllers/memcg/stress/memcg_process_stress.c<br>
+++ testcases/kernel/controllers/memcg/stress/memcg_process_stress.c<br>
@@ -1,7 +1,6 @@<br>
// SPDX-License-Identifier: GPL-2.0-or-later<br>
/*<br>
* Copyright (c) 2009 FUJITSU LIMITED<br>
- *<br>
* Author: Li Zefan <lizf@cn.fujitsu.com><br>
*/<br>
<br>
diff --git testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh<br>
index 652d99e55..9972b6c45 100755<br>
--- testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh<br>
+++ testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh<br>
@@ -7,25 +7,23 @@<br>
# Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com><br>
# Added memcg enable/disable functionality: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com<br>
<br>
-TST_TESTFUNC=testcase_<br>
-TST_SETUP=do_setup<br>
-TST_CLEANUP=do_cleanup<br>
+TST_TESTFUNC=test<br>
+TST_SETUP=setup<br>
+TST_CLEANUP=cleanup<br>
TST_CNT=2<br>
TST_NEEDS_ROOT=1<br>
TST_NEEDS_CMDS="mount umount cat kill mkdir rmdir grep awk cut"<br>
<br>
-# Each test case runs for 900 secs when everything fine...<br>
-# ...so the default 5mins timeout is not enough.<br>
+# Each test case runs for 900 secs when everything fine<br>
+# therefore the default 5 mins timeout is not enough.<br>
LTP_TIMEOUT_MUL=7<br>
<br>
-. tst_test.sh<br>
. cgroup_lib.sh<br>
<br>
-do_setup()<br>
+setup()<br>
{<br>
- if ! is_cgroup_subsystem_available_and_enabled "memory";then<br>
- tst_res TWARN "Either Kernel does not support MEMORY resource controller or feature not enabled"<br>
- tst_brk TCONF ignored "Skipping all memory cgroup testcases...."<br>
+ if ! is_cgroup_subsystem_available_and_enabled "memory"; then<br>
+ tst_brk TCONF "Either kernel does not support Memory Resource Controller or feature not enabled"<br>
fi<br>
<br>
echo 3 > /proc/sys/vm/drop_caches<br>
@@ -40,7 +38,7 @@ do_setup()<br>
tst_res TINFO "Calculated available memory $MEM MB"<br>
}<br>
<br>
-do_cleanup()<br>
+cleanup()<br>
{<br>
if [ -e /dev/memcg ]; then<br>
umount /dev/memcg 2> /dev/null<br>
@@ -50,15 +48,12 @@ do_cleanup()<br>
<br>
do_mount()<br>
{<br>
- do_cleanup<br>
+ cleanup<br>
<br>
mkdir /dev/memcg 2> /dev/null<br>
mount -t cgroup -omemory memcg /dev/memcg<br>
}<br>
<br>
-<br>
-# Run the stress test<br>
-#<br>
# $1 - Number of cgroups<br>
# $2 - Allocated how much memory in one process? in MB<br>
# $3 - The interval to touch memory in a process<br>
@@ -69,34 +64,31 @@ run_stress()<br>
<br>
do_mount<br>
<br>
- for i in $(seq 0 $(($1-1)))<br>
- do<br>
+ for i in $(seq 0 $(($1-1))); do<br>
mkdir /dev/memcg/$i 2> /dev/null<br>
memcg_process_stress $2 $3 &<br>
- eval local pid$i=$!<br>
+ eval pid$i=$!<br>
<br>
eval echo \$pid$i > /dev/memcg/$i/tasks<br>
done<br>
<br>
- for i in $(seq 0 $(($1-1)))<br>
- do<br>
+ for i in $(seq 0 $(($1-1))); do<br>
eval kill -USR1 \$pid$i 2> /dev/null<br>
done<br>
<br>
sleep $4<br>
<br>
- for i in $(seq 0 $(($1-1)))<br>
- do<br>
+ for i in $(seq 0 $(($1-1))); do<br>
eval kill -KILL \$pid$i 2> /dev/null<br>
eval wait \$pid$i<br>
<br>
rmdir /dev/memcg/$i 2> /dev/null<br>
done<br>
<br>
- do_cleanup<br>
+ cleanup<br>
}<br>
<br>
-testcase_1()<br>
+test1()<br>
{<br>
tst_res TINFO "testcase 1 started...it will run for $RUN_TIME secs"<br>
<br>
@@ -105,7 +97,7 @@ testcase_1()<br>
tst_res TPASS "stress test 1 passed"<br>
}<br>
<br>
-testcase_2()<br>
+test2()<br>
{<br>
tst_res TINFO "testcase 2 started...it will run for $RUN_TIME secs"<br>
<br>
</div>
</span></font></div>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose,
or store or copy the information in any medium. Thank you.
</body>
</html>