staging: csr: oska: remove all.h and types.h
[linux/fpc-iii.git] / tools / testing / selftests / vm / run_vmtests
blob8b40bd5e5cc2554d104cb0ba5d03ac949e918c68
1 #!/bin/bash
2 #please run as root
4 #we need 256M, below is the size in kB
5 needmem=262144
6 mnt=./huge
8 #get pagesize and freepages from /proc/meminfo
9 while read name size unit; do
10 if [ "$name" = "HugePages_Free:" ]; then
11 freepgs=$size
13 if [ "$name" = "Hugepagesize:" ]; then
14 pgsize=$size
16 done < /proc/meminfo
18 #set proper nr_hugepages
19 if [ -n "$freepgs" ] && [ -n "$pgsize" ]; then
20 nr_hugepgs=`cat /proc/sys/vm/nr_hugepages`
21 needpgs=`expr $needmem / $pgsize`
22 if [ $freepgs -lt $needpgs ]; then
23 lackpgs=$(( $needpgs - $freepgs ))
24 echo $(( $lackpgs + $nr_hugepgs )) > /proc/sys/vm/nr_hugepages
25 if [ $? -ne 0 ]; then
26 echo "Please run this test as root"
27 exit 1
30 else
31 echo "no hugetlbfs support in kernel?"
32 exit 1
35 mkdir $mnt
36 mount -t hugetlbfs none $mnt
38 echo "--------------------"
39 echo "runing hugepage-mmap"
40 echo "--------------------"
41 ./hugepage-mmap
42 if [ $? -ne 0 ]; then
43 echo "[FAIL]"
44 else
45 echo "[PASS]"
48 shmmax=`cat /proc/sys/kernel/shmmax`
49 shmall=`cat /proc/sys/kernel/shmall`
50 echo 268435456 > /proc/sys/kernel/shmmax
51 echo 4194304 > /proc/sys/kernel/shmall
52 echo "--------------------"
53 echo "runing hugepage-shm"
54 echo "--------------------"
55 ./hugepage-shm
56 if [ $? -ne 0 ]; then
57 echo "[FAIL]"
58 else
59 echo "[PASS]"
61 echo $shmmax > /proc/sys/kernel/shmmax
62 echo $shmall > /proc/sys/kernel/shmall
64 echo "--------------------"
65 echo "runing map_hugetlb"
66 echo "--------------------"
67 ./map_hugetlb
68 if [ $? -ne 0 ]; then
69 echo "[FAIL]"
70 else
71 echo "[PASS]"
74 #cleanup
75 umount $mnt
76 rm -rf $mnt
77 echo $nr_hugepgs > /proc/sys/vm/nr_hugepages