From patchwork Tue Jan 29 17:44:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1032923 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43pv550jD2z9s1l for ; Wed, 30 Jan 2019 04:44:25 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 4E3123EAD0C for ; Tue, 29 Jan 2019 18:44:22 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) by picard.linux.it (Postfix) with ESMTP id 1297D3EA033 for ; Tue, 29 Jan 2019 18:44:20 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 9F7C2140074D for ; Tue, 29 Jan 2019 18:44:18 +0100 (CET) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 24A17B08E; Tue, 29 Jan 2019 17:44:16 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Date: Tue, 29 Jan 2019 18:44:08 +0100 Message-Id: <20190129174408.13796-1-pvorel@suse.cz> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH 1/1] memcg_stress_test.sh: Further cleanup X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Petr Vorel --- Hi Cristian, I suggest this changes, to be applied after your patch "[v3] memcg_stress_test.sh: ported to newlib" [1]. Do you agree? Could you test it? Some more questions: * I wonder if rmdir in cleanup is needed (at least on latest kernel umount is enough): rmdir /dev/memcg 2> /dev/null * I'd drop cleanup either from do_mount or run_stress. It does not harm, but it looks to be redundant. Kind regards, Petr [1] https://patchwork.ozlabs.org/patch/1020689/ --- .../memcg/stress/memcg_stress_test.sh | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh index 9972b6c45..3e0d40e84 100755 --- a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +++ b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh @@ -54,35 +54,41 @@ do_mount() mount -t cgroup -omemory memcg /dev/memcg } -# $1 - Number of cgroups -# $2 - Allocated how much memory in one process? in MB -# $3 - The interval to touch memory in a process -# $4 - How long does this test run ? in second +# $1 Number of cgroups +# $2 Allocated how much memory in one process? in MB +# $3 The interval to touch memory in a process +# $4 How long does this test run ? in second run_stress() { - local i + local cgroups="$1" + local mem_size="$2" + local interval="$3" + local timeout="$4" + local i pids + + tst_res TINFO "Testing $cgroups cgroups, using $mem_size MB, interval $interval, run for $RUN_TIME secs" do_mount - for i in $(seq 0 $(($1-1))); do + for i in $(seq 0 $(($cgroups-1))); do mkdir /dev/memcg/$i 2> /dev/null - memcg_process_stress $2 $3 & - eval pid$i=$! - - eval echo \$pid$i > /dev/memcg/$i/tasks + memcg_process_stress $mem_size $interval & + echo $! > /dev/memcg/$i/tasks + pids="$! $pids" done - for i in $(seq 0 $(($1-1))); do - eval kill -USR1 \$pid$i 2> /dev/null + for pid in $pids; do + kill -USR1 $pid 2> /dev/null done - sleep $4 - - for i in $(seq 0 $(($1-1))); do - eval kill -KILL \$pid$i 2> /dev/null - eval wait \$pid$i + sleep $timeout + i=0 + for pid in $pids; do + kill -KILL $pid 2> /dev/null + wait $pid rmdir /dev/memcg/$i 2> /dev/null + i=$((i+1)) done cleanup @@ -90,19 +96,13 @@ run_stress() test1() { - tst_res TINFO "testcase 1 started...it will run for $RUN_TIME secs" - run_stress 150 $(( ($MEM - 150) / 150 )) 5 $RUN_TIME - tst_res TPASS "stress test 1 passed" } test2() { - tst_res TINFO "testcase 2 started...it will run for $RUN_TIME secs" - run_stress 1 $MEM 5 $RUN_TIME - tst_res TPASS "stress test 2 passed" }