#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
# allocate % of memory to huge pages
mem_kbytes=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`
hp_size_kbytes=`cat /proc/meminfo | grep Hugepagesize | awk '{print $2}'`
nr_huge_pages=`echo "$mem_kbytes / $hp_size_kbytes * 94 / 100" | bc`
echo 0 >/proc/sys/vm/nr_hugepages
echo "3" >/proc/sys/vm/drop_caches
echo "$nr_huge_pages" >/proc/sys/vm/nr_hugepages
mkdir /dev/hugepages
mount -t hugetlbfs hugetlbfs /dev/hugepages
/etc/init.d/libvirtd restart
