All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] controllers/memcg_stress: fix order of process cleanup
@ 2021-07-20 14:34 Krzysztof Kozlowski
  2021-09-08 15:26   ` Cyril Hrubis
  0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-20 14:34 UTC (permalink / raw)
  To: ltp

The memcg_stress_test was forking test processes and adding them to new
cgroup.  However cleanup - killing forked process and cgroup removal -
was iterating in mixed up order: killing the newest process but trying
to remove the oldest cgroup.

This could work if all processes died already via earlier "kill -USR1"
but at least in case of Ubuntu with v4.15 kernel this failed and left
cgroups not cleaned up:

    + kill -KILL 3147
    /home/azure/ltp-install/testcases/bin/memcg_stress_test.sh: 96: kill: No such process
    + wait 3147
    + rmdir /dev/memcg/0
    /home/azure/ltp-install/testcases/bin/memcg_stress_test.sh: 98: /home/azure/ltp-install/testcases/bin/memcg_stress_test.sh: Cannot fork

    $ ll /dev/memcg
    0    107  116  125  134  143  18  27  36  45  54  63  72  81  90
    1    108  117  126  135  144  19  28  37  46  55  64  73  82  91

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 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 cd75c704a9a4..c2501e164018 100755
--- a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
+++ b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
@@ -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
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [LTP] [PATCH] controllers/memcg_stress: fix order of process cleanup
@ 2021-09-08 15:26   ` Cyril Hrubis
  0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2021-09-08 15:26 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: ltp

Hi!
Good catch, applied, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-08 15:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20 14:34 [LTP] [PATCH] controllers/memcg_stress: fix order of process cleanup Krzysztof Kozlowski
2021-09-08 15:26 ` Cyril Hrubis
2021-09-08 15:26   ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.