mm: rename alloc_pages_exact_node() to __alloc_pages_node()
[linux/fpc-iii.git] / tools / testing / selftests / vm / run_vmtests
blob9179ce8df485d7b125b7e3619f7d82ee4df5ea64
1 #!/bin/bash
2 #please run as root
4 #we need 256M, below is the size in kB
5 needmem=262144
6 mnt=./huge
7 exitcode=0
9 #get pagesize and freepages from /proc/meminfo
10 while read name size unit; do
11 if [ "$name" = "HugePages_Free:" ]; then
12 freepgs=$size
14 if [ "$name" = "Hugepagesize:" ]; then
15 pgsize=$size
17 done < /proc/meminfo
19 #set proper nr_hugepages
20 if [ -n "$freepgs" ] && [ -n "$pgsize" ]; then
21 nr_hugepgs=`cat /proc/sys/vm/nr_hugepages`
22 needpgs=`expr $needmem / $pgsize`
23 if [ $freepgs -lt $needpgs ]; then
24 lackpgs=$(( $needpgs - $freepgs ))
25 echo $(( $lackpgs + $nr_hugepgs )) > /proc/sys/vm/nr_hugepages
26 if [ $? -ne 0 ]; then
27 echo "Please run this test as root"
28 exit 1
31 else
32 echo "no hugetlbfs support in kernel?"
33 exit 1
36 mkdir $mnt
37 mount -t hugetlbfs none $mnt
39 echo "--------------------"
40 echo "running hugepage-mmap"
41 echo "--------------------"
42 ./hugepage-mmap
43 if [ $? -ne 0 ]; then
44 echo "[FAIL]"
45 exitcode=1
46 else
47 echo "[PASS]"
50 shmmax=`cat /proc/sys/kernel/shmmax`
51 shmall=`cat /proc/sys/kernel/shmall`
52 echo 268435456 > /proc/sys/kernel/shmmax
53 echo 4194304 > /proc/sys/kernel/shmall
54 echo "--------------------"
55 echo "running hugepage-shm"
56 echo "--------------------"
57 ./hugepage-shm
58 if [ $? -ne 0 ]; then
59 echo "[FAIL]"
60 exitcode=1
61 else
62 echo "[PASS]"
64 echo $shmmax > /proc/sys/kernel/shmmax
65 echo $shmall > /proc/sys/kernel/shmall
67 echo "--------------------"
68 echo "running map_hugetlb"
69 echo "--------------------"
70 ./map_hugetlb
71 if [ $? -ne 0 ]; then
72 echo "[FAIL]"
73 exitcode=1
74 else
75 echo "[PASS]"
78 echo "NOTE: The above hugetlb tests provide minimal coverage. Use"
79 echo " https://github.com/libhugetlbfs/libhugetlbfs.git for"
80 echo " hugetlb regression testing."
82 echo "--------------------"
83 echo "running userfaultfd"
84 echo "--------------------"
85 ./userfaultfd 128 32
86 if [ $? -ne 0 ]; then
87 echo "[FAIL]"
88 exitcode=1
89 else
90 echo "[PASS]"
93 #cleanup
94 umount $mnt
95 rm -rf $mnt
96 echo $nr_hugepgs > /proc/sys/vm/nr_hugepages
98 echo "-----------------------"
99 echo "running compaction_test"
100 echo "-----------------------"
101 ./compaction_test
102 if [ $? -ne 0 ]; then
103 echo "[FAIL]"
104 exitcode=1
105 else
106 echo "[PASS]"
109 exit $exitcode