#!/bin/sh # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (c) 2009 FUJITSU LIMITED # Copyright (c) 2016 Cyril Hrubis # Copyright (c) 2021 Joerg Vehlow # # Author: Li Zefan # Restructure for LTP: Shi Weihua # Added memcg enable/disable functionality: Rishikesh K Rajak MEMCG_TESTFUNC=test MEMCG_SHMMAX=1 TST_TEST_DATA="--mmap-anon --mmap-file --shm" . memcg_lib.sh MEMORY_LIMIT=$PAGESIZE MEMORY_TO_ALLOCATE=$((MEMORY_LIMIT * 2)) test() { echo $MEMORY_LIMIT > memory.limit_in_bytes start_memcg_process $2 -s ${MEMORY_TO_ALLOCATE} echo $MEMCG_PROCESS_PID > tasks signal_memcg_process ${MEMORY_TO_ALLOCATE} signal_memcg_process ${MEMORY_TO_ALLOCATE} stop_memcg_process failcnt=$(cat memory.failcnt) if [ $failcnt -gt 0 ]; then tst_res TPASS "memory.failcnt is $failcnt, > 0 as expected" else tst_res TFAIL "memory.failcnt is $failcnt, <= 0 expected" fi } tst_run