4 #we need 256M, below is the size in kB
8 #get pagesize and freepages from /proc/meminfo
9 while read name size unit
; do
10 if [ "$name" = "HugePages_Free:" ]; then
13 if [ "$name" = "Hugepagesize:" ]; then
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
26 echo "Please run this test as root"
31 echo "no hugetlbfs support in kernel?"
36 mount
-t hugetlbfs none
$mnt
38 echo "--------------------"
39 echo "runing hugepage-mmap"
40 echo "--------------------"
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 "--------------------"
61 echo $shmmax > /proc
/sys
/kernel
/shmmax
62 echo $shmall > /proc
/sys
/kernel
/shmall
64 echo "--------------------"
65 echo "runing map_hugetlb"
66 echo "--------------------"
77 echo $nr_hugepgs > /proc
/sys
/vm
/nr_hugepages