• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0-or-later
3# Copyright (c) 2009 FUJITSU LIMITED
4# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
5# Copyright (c) 2018 Linux Test Project
6# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
7#
8# Author: Li Zefan <lizf@cn.fujitsu.com>
9# Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>
10# Added memcg enable/disable functinality: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com
11
12MEMCG_TESTFUNC=test
13MEMCG_SHMMAX=1
14TST_CNT=10
15
16. memcg_lib.sh
17
18# Test the management and counting of memory
19test1()
20{
21	test_mem_stat "--mmap-anon" $PAGESIZES $PAGESIZES "rss" $PAGESIZES $PAGESIZES false
22}
23
24test2()
25{
26	test_mem_stat "--mmap-file" $PAGESIZE $PAGESIZE "rss" 0 0 false
27}
28
29test3()
30{
31	test_mem_stat "--shm -k 3" $PAGESIZE $PAGESIZE "rss" 0 0 false
32}
33
34test4()
35{
36	test_mem_stat "--mmap-anon --mmap-file --shm" \
37		$PAGESIZES $((PAGESIZES * 3)) "rss" $PAGESIZES $PAGESIZES false
38}
39
40test5()
41{
42	test_mem_stat "--mmap-lock1" $PAGESIZES $PAGESIZES "rss" $PAGESIZES $PAGESIZES false
43}
44
45test6()
46{
47	test_mem_stat "--mmap-anon" $PAGESIZES $PAGESIZES "rss" $PAGESIZES $PAGESIZES true
48}
49
50test7()
51{
52	test_mem_stat "--mmap-file" $PAGESIZE $PAGESIZE "rss" 0 0 true
53}
54
55test8()
56{
57	test_mem_stat "--shm -k 8" $PAGESIZE $PAGESIZE "rss" 0 0 true
58}
59
60test9()
61{
62	test_mem_stat "--mmap-anon --mmap-file --shm" \
63		$PAGESIZES $((PAGESIZES * 3)) "rss" $PAGESIZES $PAGESIZES true
64}
65
66test10()
67{
68	test_mem_stat "--mmap-lock1" $PAGESIZES $PAGESIZES "rss" $PAGESIZES $PAGESIZES true
69}
70
71tst_run
72