From bda92ad659a52d38ac810099f69adff626b064c6 Mon Sep 17 00:00:00 2001 From: Joerg Vehlow Date: Mon, 27 Jun 2022 10:44:49 +0200 Subject: [PATCH] memcg/functional: Fix usage of PAGESIZE from memcg_lib.sh $PAGESIZES is set in memcg_lib.sh, which was moved to the bottom of the file. Fixes: 04021637f ("tst_test.sh: Cleanup getopts usage") Reviewed-by: Petr Vorel Signed-off-by: Joerg Vehlow [ upstream status: bda92ad659a52d38ac810099f69adff626b064c6 ] --- .../controllers/memcg/functional/memcg_failcnt.sh | 7 ++++--- .../memcg/functional/memcg_max_usage_in_bytes_test.sh | 10 +++++----- .../memcg/functional/memcg_subgroup_charge.sh | 8 ++++---- .../memcg/functional/memcg_usage_in_bytes_test.sh | 10 +++++----- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/testcases/kernel/controllers/memcg/functional/memcg_failcnt.sh b/testcases/kernel/controllers/memcg/functional/memcg_failcnt.sh index 1fed01569..1be98a056 100755 --- a/testcases/kernel/controllers/memcg/functional/memcg_failcnt.sh +++ b/testcases/kernel/controllers/memcg/functional/memcg_failcnt.sh @@ -12,9 +12,6 @@ MEMCG_TESTFUNC=test MEMCG_SHMMAX=1 TST_TEST_DATA="--mmap-anon --mmap-file --shm" -MEMORY_LIMIT=$PAGESIZE -MEMORY_TO_ALLOCATE=$((MEMORY_LIMIT * 2)) - test() { ROD echo $MEMORY_LIMIT \> memory.limit_in_bytes @@ -36,4 +33,8 @@ test() } . memcg_lib.sh + +MEMORY_LIMIT=$PAGESIZE +MEMORY_TO_ALLOCATE=$((MEMORY_LIMIT * 2)) + tst_run diff --git a/testcases/kernel/controllers/memcg/functional/memcg_max_usage_in_bytes_test.sh b/testcases/kernel/controllers/memcg/functional/memcg_max_usage_in_bytes_test.sh index d1ffbe053..302810513 100755 --- a/testcases/kernel/controllers/memcg/functional/memcg_max_usage_in_bytes_test.sh +++ b/testcases/kernel/controllers/memcg/functional/memcg_max_usage_in_bytes_test.sh @@ -9,11 +9,6 @@ MEMCG_TESTFUNC=test TST_CNT=4 - -MEM_TO_ALLOC=$((PAGESIZE * 1024)) -MEM_EXPECTED_UPPER=$((MEM_TO_ALLOC + MEM_USAGE_RANGE)) -MEM_LIMIT=$((MEM_TO_ALLOC * 2)) - # Run test cases which checks memory.[memsw.]max_usage_in_bytes after make # some memory allocation test_max_usage_in_bytes() @@ -88,4 +83,9 @@ test4() } . memcg_lib.sh + +MEM_TO_ALLOC=$((PAGESIZE * 1024)) +MEM_EXPECTED_UPPER=$((MEM_TO_ALLOC + MEM_USAGE_RANGE)) +MEM_LIMIT=$((MEM_TO_ALLOC * 2)) + tst_run diff --git a/testcases/kernel/controllers/memcg/functional/memcg_subgroup_charge.sh b/testcases/kernel/controllers/memcg/functional/memcg_subgroup_charge.sh index 08b6697d4..9bcc01258 100755 --- a/testcases/kernel/controllers/memcg/functional/memcg_subgroup_charge.sh +++ b/testcases/kernel/controllers/memcg/functional/memcg_subgroup_charge.sh @@ -12,10 +12,6 @@ MEMCG_TESTFUNC=test TST_CNT=3 - -# Allocate memory bigger than per-cpu kernel memory -MEM_TO_ALLOC=$((PAGESIZES * 2)) - # Test the memory charge won't move to subgroup # $1 - memory.limit_in_bytes in sub group test_subgroup() @@ -67,4 +63,8 @@ test3() } . memcg_lib.sh + +# Allocate memory bigger than per-cpu kernel memory +MEM_TO_ALLOC=$((PAGESIZES * 2)) + tst_run diff --git a/testcases/kernel/controllers/memcg/functional/memcg_usage_in_bytes_test.sh b/testcases/kernel/controllers/memcg/functional/memcg_usage_in_bytes_test.sh index 6f932124e..125d88e55 100755 --- a/testcases/kernel/controllers/memcg/functional/memcg_usage_in_bytes_test.sh +++ b/testcases/kernel/controllers/memcg/functional/memcg_usage_in_bytes_test.sh @@ -9,11 +9,6 @@ MEMCG_TESTFUNC=test TST_CNT=2 - -MEM_TO_ALLOC=$((PAGESIZE * 1024)) -MEM_EXPECTED_UPPER=$((MEM_TO_ALLOC + MEM_USAGE_RANGE)) -MEM_LIMIT=$((MEM_TO_ALLOC * 2)) - test1() { tst_res TINFO "Test memory.usage_in_bytes" @@ -35,4 +30,9 @@ test2() } . memcg_lib.sh + +MEM_TO_ALLOC=$((PAGESIZE * 1024)) +MEM_EXPECTED_UPPER=$((MEM_TO_ALLOC + MEM_USAGE_RANGE)) +MEM_LIMIT=$((MEM_TO_ALLOC * 2)) + tst_run -- 2.37.1