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