Lines Matching +full:1 +full:- +full:1024

2 # SPDX-License-Identifier: GPL-2.0
4 # Kselftest framework requirement - SKIP code is 4.
7 set -e
9 if [[ $(id -u) -ne 0 ]]; then
17 if [[ "$1" == "-cgroup-v2" ]]; then
18 cgroup2=1
24 CGROUP_ROOT=$(mount -t cgroup2 | head -1 | awk '{print $3}')
25 if [[ -z "$CGROUP_ROOT" ]]; then
26 CGROUP_ROOT=$(mktemp -d)
27 mount -t cgroup2 none $CGROUP_ROOT
28 do_umount=1
32 CGROUP_ROOT=$(mount -t cgroup | grep ",hugetlb" | awk '{print $3}')
33 if [[ -z "$CGROUP_ROOT" ]]; then
35 mount -t cgroup memory,hugetlb $CGROUP_ROOT
36 do_umount=1
42 hpz=$(grep -i hugepagesize /proc/meminfo)
43 kb=${hpz:14:-3}
44 mb=$(($kb / 1024))
53 rm -rf "$MNT"/* 2>/dev/null
60 set -e
64 local expected_a="$1"
69 if [ ! -z ${3:-} ] && [ ! -z ${4:-} ]; then
73 local tolerance=$((5 * 1024 * 1024))
77 if [[ $actual_a -lt $(($expected_a - $tolerance)) ]] ||
78 [[ $actual_a -gt $(($expected_a + $tolerance)) ]]; then
79 echo actual a = $((${actual_a%% *} / 1024 / 1024)) MB
80 echo expected a = $((${expected_a%% *} / 1024 / 1024)) MB
84 exit 1
89 if [[ $actual_a_hugetlb -lt $(($expected_a_hugetlb - $tolerance)) ]] ||
90 [[ $actual_a_hugetlb -gt $(($expected_a_hugetlb + $tolerance)) ]]; then
91 echo actual a hugetlb = $((${actual_a_hugetlb%% *} / 1024 / 1024)) MB
92 echo expected a hugetlb = $((${expected_a_hugetlb%% *} / 1024 / 1024)) MB
96 exit 1
99 if [[ -z "$expected_b" || -z "$expected_b_hugetlb" ]]; then
105 if [[ $actual_b -lt $(($expected_b - $tolerance)) ]] ||
106 [[ $actual_b -gt $(($expected_b + $tolerance)) ]]; then
107 echo actual b = $((${actual_b%% *} / 1024 / 1024)) MB
108 echo expected b = $((${expected_b%% *} / 1024 / 1024)) MB
112 exit 1
117 if [[ $actual_b_hugetlb -lt $(($expected_b_hugetlb - $tolerance)) ]] ||
118 [[ $actual_b_hugetlb -gt $(($expected_b_hugetlb + $tolerance)) ]]; then
119 echo actual b hugetlb = $((${actual_b_hugetlb%% *} / 1024 / 1024)) MB
120 echo expected b hugetlb = $((${expected_b_hugetlb%% *} / 1024 / 1024)) MB
124 exit 1
131 sleep 1
146 mkdir -p "$MNT"
147 mount -t hugetlbfs none "$MNT"
151 local cgroup="$1"
162 ./write_to_hugetlbfs -p "$path" -s "$size" -m 0 -o
171 set -e
173 size=$((${MB} * 1024 * 1024 * 25)) # 50MB = 25 * 2MB hugepages.
192 rm -rf /mnt/huge/*
219 rm -rf "$MNT"/*
243 rm -rf "$MNT"/*
254 rm -rf $CGROUP_ROOT