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=3 11 12. memcg_lib.sh 13 14test1() 15{ 16 tst_res TINFO "test if one of the ancestors goes over its limit, the proces will be killed" 17 18 echo 1 > memory.use_hierarchy 19 echo $PAGESIZE > memory.limit_in_bytes 20 21 mkdir subgroup 22 cd subgroup 23 test_proc_kill $((PAGESIZE * 3)) "--mmap-lock1" $((PAGESIZE * 2)) 0 24 25 cd .. 26 rmdir subgroup 27} 28 29test2() 30{ 31 tst_res TINFO "test Enabling will fail if the cgroup already has other cgroups" 32 33 memcg_require_hierarchy_disabled 34 35 mkdir subgroup 36 EXPECT_FAIL echo 1 \> memory.use_hierarchy 37 38 rmdir subgroup 39} 40 41test3() 42{ 43 tst_res TINFO "test disabling will fail if the parent cgroup has enabled hierarchy" 44 45 memcg_require_hierarchy_disabled 46 47 echo 1 > memory.use_hierarchy 48 mkdir subgroup 49 EXPECT_FAIL echo 0 \> subgroup/memory.use_hierarchy 50 51 rmdir subgroup 52} 53 54tst_run 55