4 #we need 256M, below is the size in kB
9 #get pagesize and freepages from /proc/meminfo
10 while read name size unit
; do
11 if [ "$name" = "HugePages_Free:" ]; then
14 if [ "$name" = "Hugepagesize:" ]; then
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`
24 while [ $tries -gt 0 ] && [ $freepgs -lt $needpgs ]; do
25 lackpgs
=$
(( $needpgs - $freepgs ))
26 echo 3 > /proc
/sys
/vm
/drop_caches
27 echo $
(( $lackpgs + $nr_hugepgs )) > /proc
/sys
/vm
/nr_hugepages
29 echo "Please run this test as root"
32 while read name size unit
; do
33 if [ "$name" = "HugePages_Free:" ]; then
39 if [ $freepgs -lt $needpgs ]; then
40 printf "Not enough huge pages available (%d < %d)\n" \
45 echo "no hugetlbfs support in kernel?"
50 mount
-t hugetlbfs none
$mnt
52 echo "--------------------"
53 echo "running hugepage-mmap"
54 echo "--------------------"
63 shmmax
=`cat /proc/sys/kernel/shmmax`
64 shmall
=`cat /proc/sys/kernel/shmall`
65 echo 268435456 > /proc
/sys
/kernel
/shmmax
66 echo 4194304 > /proc
/sys
/kernel
/shmall
67 echo "--------------------"
68 echo "running hugepage-shm"
69 echo "--------------------"
77 echo $shmmax > /proc
/sys
/kernel
/shmmax
78 echo $shmall > /proc
/sys
/kernel
/shmall
80 echo "--------------------"
81 echo "running map_hugetlb"
82 echo "--------------------"
91 echo "NOTE: The above hugetlb tests provide minimal coverage. Use"
92 echo " https://github.com/libhugetlbfs/libhugetlbfs.git for"
93 echo " hugetlb regression testing."
95 echo "--------------------"
96 echo "running userfaultfd"
97 echo "--------------------"
109 echo $nr_hugepgs > /proc
/sys
/vm
/nr_hugepages
111 echo "-----------------------"
112 echo "running compaction_test"
113 echo "-----------------------"
115 if [ $?
-ne 0 ]; then
122 echo "--------------------"
123 echo "running on-fault-limit"
124 echo "--------------------"
125 sudo
-u nobody .
/on-fault-limit
126 if [ $?
-ne 0 ]; then
133 echo "--------------------"
134 echo "running mlock2-tests"
135 echo "--------------------"
137 if [ $?
-ne 0 ]; then