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`
23 if [ $freepgs -lt $needpgs ]; then
24 lackpgs
=$
(( $needpgs - $freepgs ))
25 echo $
(( $lackpgs + $nr_hugepgs )) > /proc
/sys
/vm
/nr_hugepages
27 echo "Please run this test as root"
32 echo "no hugetlbfs support in kernel?"
37 mount
-t hugetlbfs none
$mnt
39 echo "--------------------"
40 echo "running hugepage-mmap"
41 echo "--------------------"
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 "--------------------"
64 echo $shmmax > /proc
/sys
/kernel
/shmmax
65 echo $shmall > /proc
/sys
/kernel
/shmall
67 echo "--------------------"
68 echo "running map_hugetlb"
69 echo "--------------------"
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 "--------------------"
96 echo $nr_hugepgs > /proc
/sys
/vm
/nr_hugepages
98 echo "-----------------------"
99 echo "running compaction_test"
100 echo "-----------------------"
102 if [ $?
-ne 0 ]; then