1#! /bin/sh 2# SPDX-License-Identifier: GPL-2.0-or-later 3# Copyright (c) 2012 FUJITSU LIMITED 4# Copyright (c) 2014-2016 Linux Test Project 5# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de> 6# 7# Author: Peng Haitao <penght@cn.fujitsu.com> 8 9MEMCG_TESTFUNC=test 10TST_CNT=2 11 12test1() 13{ 14 tst_res TINFO "Test memory.usage_in_bytes" 15 test_mem_stat "--mmap-anon" $MEM_TO_ALLOC $MEM_TO_ALLOC \ 16 "memory.usage_in_bytes" $MEM_TO_ALLOC \ 17 $MEM_EXPECTED_UPPER false 18} 19 20test2() 21{ 22 tst_res TINFO "Test memory.memsw.usage_in_bytes" 23 memcg_require_memsw 24 25 EXPECT_PASS echo $MEM_LIMIT \> memory.limit_in_bytes 26 EXPECT_PASS echo $MEM_LIMIT \> memory.memsw.limit_in_bytes 27 test_mem_stat "--mmap-anon" $MEM_TO_ALLOC $MEM_TO_ALLOC \ 28 "memory.memsw.usage_in_bytes" $MEM_TO_ALLOC \ 29 $MEM_EXPECTED_UPPER false 30} 31 32. memcg_lib.sh 33 34MEM_TO_ALLOC=$((PAGESIZE * 1024)) 35MEM_EXPECTED_UPPER=$((MEM_TO_ALLOC + MEM_USAGE_RANGE)) 36MEM_LIMIT=$((MEM_TO_ALLOC * 2)) 37 38tst_run 39