diff options
author | sharath <sharathkumarboyanapally@gmail.com> | 2018-08-23 21:14:33 +0530 |
---|---|---|
committer | sharath <sharathkumarboyanapally@gmail.com> | 2018-09-06 10:20:37 +0530 |
commit | b8ad58fc06cef1af61a6dad31e71d4c15626f5f6 (patch) | |
tree | b43dab9ce2db9cac9ef5ae3f60be3e78de219bf5 /scripts/check_hugepage.sh | |
parent | 5686565ee3b379c590a1a09a05c92db50d206add (diff) |
Fix: enhancing the build scripts
Change-Id: Ibc52debf304335e8a69b4d3d5c5f6478d654ab88
Signed-off-by: sharath <sharathkumarboyanapally@gmail.com>
Diffstat (limited to 'scripts/check_hugepage.sh')
-rwxr-xr-x | scripts/check_hugepage.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/scripts/check_hugepage.sh b/scripts/check_hugepage.sh new file mode 100755 index 0000000..bde11a9 --- /dev/null +++ b/scripts/check_hugepage.sh @@ -0,0 +1,41 @@ +#!/bin/bash -x + +set -x + +hugepagesize=$(cat /proc/meminfo | grep Hugepagesize | awk -F " " {'print$2'}) +if [ "$hugepagesize" == "2048" ]; then + pages=1536 +elif [ "$hugepagesize" == "1048576" ]; then + pages=3 +fi +sudo sysctl -w vm.nr_hugepages=$pages +HUGEPAGES=`sysctl -n vm.nr_hugepages` +if [ $HUGEPAGES != $pages ]; then + echo "ERROR: Unable to get $pages hugepages, only got $HUGEPAGES. Cannot finish." + exit 1 +fi + +hugepageTotal=$(cat /proc/meminfo | grep -c "HugePages_Total: 0") +if [ $hugepageTotal -ne 0 ]; then + echo "HugePages_Total is zero" + exit 1 +fi + +hugepageFree=$(cat /proc/meminfo | grep -c "HugePages_Free: 0") +if [ $hugepageFree -ne 0 ]; then + echo "HugePages_Free is zero" + exit 1 +fi + +hugepageSize=$(cat /proc/meminfo | grep -c "Hugepagesize: 0 kB") +if [ $hugepageSize -ne 0 ]; then + echo "Hugepagesize is zero" + exit 1 +fi + +sudo mkdir /mnt/nstackhuge -p +if [ "$hugepagesize" == "2048" ]; then + sudo mount -t hugetlbfs -o pagesize=2M none /mnt/nstackhuge/ +elif [ "$hugepagesize" == "1048576" ]; then + sudo mount -t hugetlbfs -o pagesize=1G none /mnt/nstackhuge/ +fi |