memcg_stress newlib porting
v3 cover memcg_stress newlib porting
This converts memcg stress tests and its helper to LTP newlib and performs a general cleanup.
This patch is dependent on [1] since it factors out a common helper to cgroup_lib.sh (introduced in [1])
Changes
-------v2->v3:
- cleaned up cgroup_lib.sh helper
v1->v2:
- Restored the original usage of SIGKILL to terminate memcp_process_stress helpers after having a look at what said in previous commit:
9b9a6bb10258bc975bd1707b418699264d3bdcef
Cristian Marussi (1):
[LTP] memcg_stress_test.sh: ported to newlib
[1]: http://lists.linux.it/pipermail/ltp/2018-December/010385.html
PATCH v3 1/1 memcg_stress_test.sh: ported to newlib
Ported to newlib framework and general cleanup.
Moved an helper function out into cgroup_lib.sh.
--- testcases/kernel/controllers/cgroup_lib.sh | 16 +++ .../kernel/controllers/memcg/stress/Makefile | 21 +-- .../memcg/stress/memcg_process_stress.c | 34 ++--- .../memcg/stress/memcg_stress_test.sh | 135 ++++++++---------- 4 files changed, 92 insertions(+), 114 deletions(-)
testcases/kernel/controllers/cgroup_lib.sh +16 -0
@@ -21,3 +21,19 @@ get_cgroup_mountpoint() echo $mntpoint return 0 } + +# Check if given subsystem is supported and enabled +# is_cgroup_subsystem_available_and_enabled SUBSYSTEM +# RETURN: 0 if subsystem supported and enabled, otherwise 1 +is_cgroup_subsystem_available_and_enabled() +{ + local val + local subsystem=$1 + + [ $# -eq 0 ] && tst_brk TBROK "is_cgroup_subsystem_available_and_enabled: subsystem not defined" + + val=$(grep -w $subsystem /proc/cgroups | awk '{ print $4 }') + [ "x$val" = "x1" ] && return 0 + + return 1 +}
testcases/kernel/controllers/memcg/stress/Makefile +3 -18
@@ -1,24 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009, Cisco Systems Inc. +# Author: Ngie Cooper, September 2009 # # kernel/controllers/memcg/stress testcase suite Makefile. # -# Copyright (C) 2009, Cisco Systems Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Ngie Cooper, September 2009 -# top_srcdir ?= ../../../../..
testcases/kernel/controllers/memcg/stress/memcg_process_stress.c +10 -24
@@ -1,24 +1,9 @@ -/******************************************************************************/ -/* */ -/* Copyright (c) 2009 FUJITSU LIMITED */ -/* */ -/* This program is free software; you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation; either version 2 of the License, or */ -/* (at your option) any later version. */ -/* */ -/* This program is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ -/* the GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program; if not, write to the Free Software */ -/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -/* */ -/* Author: Li Zefan <[email protected]> */ -/* */ -/******************************************************************************/ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) 2009 FUJITSU LIMITED +* +* Author: Li Zefan <[email protected]> +*/ #include <sys/mman.h> #include <err.h>
@@ -91,14 +76,15 @@ int main(int argc, char *argv[])if (interval <=0 ) interval =1 ; -/* TODO (garrcoop): add error handling. */ memset (&sigint_action,0 ,sizeof (sigint_action)); sigint_action.sa_handler = &sigint_handler; -sigaction (SIGINT , &sigint_action,NULL ); +if (sigaction (SIGINT , &sigint_action,NULL )) +err (1 ,"sigaction(%s) failed" ,"SIGINT" );memset (&sigusr_action,0 ,sizeof (sigusr_action)); sigusr_action.sa_handler = &sigusr_handler; -sigaction (SIGUSR1 , &sigusr_action,NULL ); +if (sigaction (SIGUSR1 , &sigusr_action,NULL )) +err (1 ,"sigaction(%s) failed" ,"SIGUSR1" );while (!flag_exit) {sleep (interval);
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +63 -72
181 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 1/1 memcg_stress_test.sh: ported to newlib
Hi Cristian,
thanks for your patch. I was thinking just to fix minor formatting issues, but eval in run_stress() deserve to be rewritten.
Quoted 2 lines
Ported to newlib framework and general cleanup.
Moved an helper function out intocgroup_lib.sh.
..
testcases/kernel/controllers/cgroup_lib.sh get_cgroup_mountpoint() · line 36
Quoted 1 line
testcases/kernel/controllers/cgroup_lib.sh +1
-0+ [ "x$val" = "x1" ] && return 0
drop x, it's portable enough like this::
[ "$val" = "1" ] && return 0
...
testcases/kernel/controllers/memcg/stress/Makefile line 5
Quoted 7 lines
+++ b/testcases/kernel/controllers/memcg/stress/Makefile
testcases/kernel/controllers/memcg/stress/Makefile +3
-0@@ -1,24 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009, Cisco Systems Inc. +# Author: Ngie Cooper, September 2009 # kernel/controllers/memcg/stress testcase suite Makefile.
Delete this as well.
Quoted 1 line
(quoted diff) +1
-0+++ b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
...
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh line 28
Quoted 3 lines
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +3
-0+ if ! is_cgroup_subsystem_available_and_enabled "memory";then + tst_res TWARN "Either Kernel does not support MEMORY resource controller or feature not enabled" + tst_brk TCONF ignored "Skipping all memory cgroup testcases...."
TWARN followed by TCONF does not make sense. Also skip is redundant. Please, avoid using dots (even in comments).
This is enough:
if ! is_cgroup_subsystem_available_and_enabled "memory"; then
tst_res TCONF "Either Kernel does not support MEMORY resource controller or feature not enabled"
fi
...
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh line 34
Quoted 5 lines
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +5
-0+ + echo 3 > /proc/sys/vm/drop_caches + sleep 2 + local mem_free=`cat /proc/meminfo | grep MemFree | awk '{ print $2 }'` + local swap_free=`cat /proc/meminfo | grep SwapFree | awk '{ print $2 }'`
Test started using awk, which might not be everywhere (even it's quite basic. TST_NEEDS_CMDS="awk" would be good for tests.
And also TST_NEEDS_CMDS="$TST_NEEDS_CMDS awk" would be good for cgroup_lib.sh.
Quoted 24 lines
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +14
-1+ + MEM=$(( $mem_free + $swap_free / 2 )) + MEM=$(( $MEM / 1024 )) + RUN_TIME=$(( 15 * 60 )) + + tst_res TINFO "Calculated available memory $MEM MB" } +do_cleanup() +{ + if [ -e /dev/memcg ]; then + umount /dev/memcg 2> /dev/null + rmdir /dev/memcg 2> /dev/null + fi +} do_mount() { - cleanup; + do_cleanup mkdir /dev/memcg 2> /dev/null mount -t cgroup -omemory memcg /dev/memcg
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh do_mount() · line 73
Quoted 10 lines
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +3
-1@@ -65,62 +65,53 @@ do_mount() # $4 - How long does this test run ? in second run_stress() { - do_mount; + local i + + do_mount for i in $(seq 0 $(($1-1))) do
Please keep do on the same line (in memcg_stress_test.sh on several times):
for i in $(seq 0 $(($1-1))); do
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh do_mount() · line 74
Quoted 3 lines
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +0
-2mkdir /dev/memcg/$i 2> /dev/null - ./memcg_process_stress $2 $3 & - eval pid$i=$!
Eval is evil. And eval with local is even more evil. Even if it works on dash, using eval in whole function is just bad. Could you please rewrite it into single variable? You can just separate pids with space.
+ maybe describe variables instead of using positional variables, e.g.:
local cgroups="$1"
local mem="$2"
...
Quoted 18 lines
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +4
-2+ memcg_process_stress $2 $3 & + eval local pid$i=$! eval echo \$pid$i > /dev/memcg/$i/tasks done for i in $(seq 0 $(($1-1))) do - eval /bin/kill -s SIGUSR1 \$pid$i 2> /dev/null + eval kill -USR1 \$pid$i 2> /dev/null done sleep $4 for i in $(seq 0 $(($1-1))) do - eval /bin/kill -s SIGKILL \$pid$i 2> /dev/null + eval kill -KILL \$pid$i 2> /dev/null
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh do_mount() · line 99
Quoted 10 lines
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +1
-1eval wait \$pid$i rmdir /dev/memcg/$i 2> /dev/null done - cleanup; + do_cleanup } testcase_1()
I'd rename it to test1.
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh do_mount() · line 101
Quoted 3 lines
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +1
-1{ - run_stress 150 $(( ($mem-150) / 150 )) 5 $RUN_TIME + tst_res TINFO "testcase 1 started...it will run for $RUN_TIME secs"
Can you avoid dots, will?
Maybe describe it a bit.
I'd print test info in run_stress(), something like this:tst_res TINFO "Testing $cgroups cgroups, using $mem, run for $RUN_TIME secs"
Kind regards,
Petr
PATCH v3 1/1 memcg_stress_test.sh: ported to newlib
Hi Cristian,
I suggest following cleanup of your patch (see bellow).
This change, with my other cleanup patch [1] + your patch [2] can be seen on [3].
Kind regards,
Petr
[1] https://patchwork.ozlabs.org/patch/1032923/
[2] https://patchwork.ozlabs.org/patch/1020887/
[3] https://github.com/pevik/ltp/commits/christian/memcg_stress_test.sh.v3.fixes
kernel/controllers/cgroup_lib.sh +1 -1
@@ -33,7 +33,7 @@ is_cgroup_subsystem_available_and_enabled() [ $# -eq 0 ] && tst_brk TBROK "is_cgroup_subsystem_available_and_enabled: subsystem not defined" val=$(grep -w $subsystem /proc/cgroups | awk '{ print $4 }') - [ "x$val" = "x1" ] && return 0 + [ "$val" = "1" ] && return 0 return 1 }
kernel/controllers/memcg/stress/Makefile +0 -3
@@ -1,9 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2009, Cisco Systems Inc. # Author: Ngie Cooper, September 2009 -# -# kernel/controllers/memcg/stress testcase suite Makefile. -# top_srcdir ?= ../../../../..
kernel/controllers/memcg/stress/memcg_process_stress.c +0 -1
@@ -1,7 +1,6 @@// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2009 FUJITSU LIMITED -* * Author: Li Zefan <[email protected]> */
kernel/controllers/memcg/stress/memcg_stress_test.sh +17 -25
105 lines not on this page · raw message
PATCH v3 1/1 memcg_stress_test.sh: ported to newlib
Hi
On 29/01/2019 17:50, Petr Vorel wrote:> Hi Cristian,
Quoted 7 lines
I suggest following cleanup of your patch (see bellow).
This change, with my other cleanup patch [1] + your patch [2] can be seen on [3].
Kind regards,
Petr
Thanks for the review and the cleanup. (next I was going to rework following your today's advises, but you've been faster...)
I'll test asap.
Thanks
Regards
Cristian
________________________________
From: Petr Vorel <[email protected]>
Sent: 29 January 2019 17:50:19
To: Cristian Marussi
Cc: [email protected]
Subject: Re: [LTP] [PATCH v3] memcg_stress_test.sh: ported to newlib
Hi Cristian,
I suggest following cleanup of your patch (see bellow).
This change, with my other cleanup patch [1] + your patch [2] can be seen on [3].
Kind regards,
Petr
[1] https://patchwork.ozlabs.org/patch/1032923/
[2] https://patchwork.ozlabs.org/patch/1020887/
[3] https://github.com/pevik/ltp/commits/christian/memcg_stress_test.sh.v3.fixes
kernel/controllers/cgroup_lib.sh +1 -1
@@ -33,7 +33,7 @@ is_cgroup_subsystem_available_and_enabled() [ $# -eq 0 ] && tst_brk TBROK "is_cgroup_subsystem_available_and_enabled: subsystem not defined" val=$(grep -w $subsystem /proc/cgroups | awk '{ print $4 }') - [ "x$val" = "x1" ] && return 0 + [ "$val" = "1" ] && return 0 return 1 }
kernel/controllers/memcg/stress/Makefile +0 -3
@@ -1,9 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2009, Cisco Systems Inc. # Author: Ngie Cooper, September 2009 -# -# kernel/controllers/memcg/stress testcase suite Makefile. -# top_srcdir ?= ../../../../..
kernel/controllers/memcg/stress/memcg_process_stress.c +0 -1
@@ -1,7 +1,6 @@// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2009 FUJITSU LIMITED -* * Author: Li Zefan <[email protected]> */
kernel/controllers/memcg/stress/memcg_stress_test.sh +17 -25
105 lines not on this page · raw message
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. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190129/95a19364/attachment.html>
PATCH v3 1/1 memcg_stress_test.sh: ported to newlib
Hi Cristian,
Quoted 1 line
Thanks for the review and the cleanup. (next I was going to rework following your today's advises, but you've been faster...)
I'm sorry, I'll be patient next time :).
I was thinking to add these changes to your commit and merge patchset, but as I introduced 2 regressions in your patchset last time (I test it of course), I was careful.
Quoted 1 line
I'll test asap.
Thanks a lot!
Kind regards,
Petr
PATCH v3 1/1 memcg_stress_test.sh: ported to newlib
Hi
Quoted 10 lines · Petr Vorel
Hi Cristian,
Quoted 1 line
Thanks for the review and the cleanup. (next I was going to rework following your today's advises, but you've been faster...)
I'm sorry, I'll be patient next time :).
I was thinking to add these changes to your commit and merge patchset, but as I introduced 2 regressions in your patchset last time (I test it of course), I was careful.Quoted 1 line
I'll test asap.
Thanks a lot!
Tested from you branch with ToT as:
10df48aa7 (HEAD -> pevik_ltp/christian/memcg_stress_test.sh.v3.fixes) memcg_stress_test.sh: fix memory usageebd6efaa6 memcg_stress_test.sh: Further cleanup02c520928 memcg_stress_test.sh: ported to newlibfc544f842 controllers/mem_process.c: Fix comparison warning
...
on 4k/64k pages defocnfig....looks fine to me.
Thanks a lot for the cleanup.
Regards
Cristian
Quoted 5 lines
Kind regards,
Petr
PATCH v3 1/1 memcg_stress_test.sh: ported to newlib
Hi Cristian,
Quoted 9 lines
Tested from you branch with ToT as:
10df48aa7(HEAD -> pevik_ltp/christian/memcg_stress_test.sh.v3.fixes)memcg_stress_test.sh: fix memory usageebd6efaa6memcg_stress_test.sh: Further cleanup02c520928memcg_stress_test.sh: ported to newlibfc544f842controllers/mem_process.c: Fix comparison warning
...
Quoted 3 lines
on 4k/64k pages defocnfig....looks fine to me.
Thanks a lot for the cleanup.
Thanks a lot for testing!
Pushed (with your Tested-by on my commit).
I did few cleanup changes in my commit (TINFO messages, fix missing local pid, redirect stderr for wait to make it quiet, move TPASS message into run_stress()).
I wonder how to suppress kill message for the first cgroup pid:/opt/ltp/testcases/bin/memcg_stress_test.sh: line 65: 14750 User defined signal 1 memcg_process_stress $mem_size $interval
This pid is the only one killed by -USR1, but line 65 is not in fist kill loop. Therefore it cannot be killed by -KILL (second kill loop).
Kind regards,
Petr
PATCH v3 1/1 memcg_stress_test.sh: ported to newlib
Hi Petr
Quoted 17 lines · Petr Vorel
Hi Cristian,
Quoted 9 lines
Tested from you branch with ToT as:
10df48aa7(HEAD -> pevik_ltp/christian/memcg_stress_test.sh.v3.fixes)memcg_stress_test.sh: fix memory usageebd6efaa6memcg_stress_test.sh: Further cleanup02c520928memcg_stress_test.sh: ported to newlibfc544f842controllers/mem_process.c: Fix comparison warning
...Quoted 3 lines
on 4k/64k pages defocnfig....looks fine to me.
Thanks a lot for the cleanup.
Thanks a lot for testing!
Pushed (with your Tested-by on my commit).
Quoted 9 lines
I did few cleanup changes in my commit (TINFO messages, fix missing local pid, redirect stderr for wait to make it quiet, move TPASS message into
run_stress()).I wonder how to suppress kill message for the first cgroup pid:
/opt/ltp/testcases/bin/memcg_stress_test.sh: line 65: 14750 User defined signal 1memcg_process_stress$mem_size $intervalThis pid is the only one killed by -USR1, but line 65 is not in fist kill loop. Therefore it cannot be killed by -KILL (second kill loop).
? ... I saw no error messages in my testing :D
Regards
Cristian
PATCH v3 1/1 memcg_stress_test.sh: ported to newlib
In reply to Petr VorelQuoted 11 lines · Petr Vorel
Hi Cristian,
Quoted 9 lines
Tested from you branch with ToT as:
10df48aa7(HEAD -> pevik_ltp/christian/memcg_stress_test.sh.v3.fixes)memcg_stress_test.sh: fix memory usageebd6efaa6memcg_stress_test.sh: Further cleanup02c520928memcg_stress_test.sh: ported to newlibfc544f842controllers/mem_process.c: Fix comparison warning
...
on 4k/64k pages defocnfig....looks fine to me.
Thanks a lot for the cleanup.
Quoted 8 lines
Thanks a lot for testing!
Pushed (with your Tested-by on my commit).I did few cleanup changes in my commit (TINFO messages, fix missing local pid, redirect stderr for wait to make it quiet, move TPASS message into
run_stress()).I wonder how to suppress kill message for the first cgroup pid:
/opt/ltp/testcases/bin/memcg_stress_test.sh: line 65: 14750 User defined signal 1memcg_process_stress$mem_size $interval
Hi Petr, Cristian
I also saw the same message occasionally when running memcg_stress_test, as below:
-----------------------------------------------------------------------
.../opt/ltp/testcases/bin/memcg_stress_test.sh: line 65: 11262 User defined
signal 1 memcg_process_stress $mem_size $interval/opt/ltp/testcases/bin/memcg_stress_test.sh: line 65: 11264 User defined
signal 1 memcg_process_stress $mem_size $interval/opt/ltp/testcases/bin/memcg_stress_test.sh: line 65: 11267 User defined
signal 1 memcg_process_stress $mem_size $interval
...
-----------------------------------------------------------------------
It is possible for memcg_process_stress to be killed by SIGUSR1(default action), because it may
have received SIGUSR1 before completing the specified initialization of SIGUSR1 signal action.
Perpahs, we should sleep a few seconds to wait for the completion of initializing SIGUSR1 signal action. :-)
Please see my patch for details:
-----------------------------------------------------------------------
(quoted diff) +0 -0
a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh index 5b19cc2..697a973 100755
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +2 -0
@@ -81,6 +81,13 @@ run_stress() pids="$! $pids" done + # If memcg_process_stress has received SIGUSR1 before completing the + # specified initialization of SIGUSR1 signal action,
memcg_process_stress
+ # will be killed by SIGUSR1(i.e. default action). So we should
wait for
+ # the completion of initializing SIGUSR1 signal action by
sleeping a few
+ # seconds.
+ sleep 2
+
for pid in $pids; do
kill -USR1 $pid 2> /dev/null
done
-----------------------------------------------------------------------
Best Regards,
Xiao Yang
Quoted 7 lines
This pid is the only one killed by -USR1, but line 65 is not in fist kill loop. Therefore it cannot be killed by -KILL (second kill loop).
Kind regards,
Petr
PATCH v3 1/1 memcg_stress_test.sh: ported to newlib
Hi Xiao
Quoted 18 lines · Xiao Yang
Quoted 1 line · Petr Vorel
Hi Cristian,
Hi Petr, Cristian
I also saw the same message occasionally when running
memcg_stress_test, as below:
-----------------------------------------------------------------------
.../opt/ltp/testcases/bin/memcg_stress_test.sh: line 65: 11262 User defined
signal 1memcg_process_stress$mem_size $interval/opt/ltp/testcases/bin/memcg_stress_test.sh: line 65: 11264 User defined
signal 1memcg_process_stress$mem_size $interval/opt/ltp/testcases/bin/memcg_stress_test.sh: line 65: 11267 User defined
signal 1memcg_process_stress$mem_size $interval
...
-----------------------------------------------------------------------
Quoted 7 lines
It is possible for
memcg_process_stressto be killed by SIGUSR1(default action), because it may
have received SIGUSR1 before completing the specified initialization of SIGUSR1 signal actionPerpahs, we should sleep a few seconds to wait for the completion of initializing SIGUSR1 signal action. :-)
Mmm...yes that's a possibility....but I was noticing that we spawn a lot of bg processes in a loop before starting signaling all of them in the following loop (i.e. after all the forks)...but I just realized than then we signal them starting from the most recently spawned...not the oldest (in reverse order)....so maybe it could be enough to start signalling from the oldest.
Signaling in the natural-born order...
(quoted diff) +0 -0
b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh index 5b19cc292..aa91f77b2 100755
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +1 -1
@@ -78,7 +78,7 @@ run_stress() mkdir /dev/memcg/$i 2> /dev/null memcg_process_stress $mem_size $interval & echo $! > /dev/memcg/$i/tasks - pids="$! $pids" + pids="$pids $!" done for pid in $pids; do
I understand that this approach is NO more deterministic than your sleeping solution, anyway.
IMHO the only real deterministic solution would be to somehow explicitly "sync" at the end of process-spawn loop, with the test script waiting for all the spawned child to be ready....but it is maybe a bit overkill for the issue we face. Maybe it is worth trying signaling in the correct order and then sleeping a bit and see if it solves...I haven't seen this issue at all on my local setup on ARM.
Regards
Thanks
Cristian
Quoted 41 lines
Please see my patch for details:
-----------------------------------------------------------------------(quoted diff) +0
-0
a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.shb/testcases/kernel/controllers/memcg/stress/memcg_stress_test.shindex 5b19cc2..697a973 100755testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +2
-0@@ -81,6 +81,13 @@ run_stress() pids="$! $pids" done + # If memcg_process_stress has received SIGUSR1 before completing the + # specified initialization of SIGUSR1 signal action,
memcg_process_stress
+ # will be killed by SIGUSR1(i.e. default action). So we should
wait for
+ # the completion of initializing SIGUSR1 signal action by
sleeping a fewtestcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +3
-1+ # seconds. + sleep 2 + for pid in $pids; do kill -USR1 $pid 2> /dev/null done -----------------------------------------------------------------------Best Regards,
Xiao YangQuoted 7 lines
This pid is the only one killed by -USR1, but line 65 is not in fist kill loop. Therefore it cannot be killed by -KILL (second kill loop).
Kind regards,
Petr