aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dmm/dmm_scripts/setup_hugepage.sh
diff options
context:
space:
mode:
authorsharath <sharathkumarboyanapally@gmail.com>2018-08-21 11:01:26 +0530
committerPeter Mikus <pmikus@cisco.com>2018-09-27 08:18:41 +0000
commit19947738140e71d8d9fa90349e68f6261f5a612f (patch)
tree663ccab317082bf17dd5382fda754f56a57848c8 /tests/dmm/dmm_scripts/setup_hugepage.sh
parentebd0c7defaffdd6cd3ff2b5f580c86601917a0c7 (diff)
integration of DMM+lwip testscripts
Change-Id: Ifb1a0702353e71c61a694dea5164df41f4e23389 Signed-off-by: sharath <sharathkumarboyanapally@gmail.com>
Diffstat (limited to 'tests/dmm/dmm_scripts/setup_hugepage.sh')
-rwxr-xr-xtests/dmm/dmm_scripts/setup_hugepage.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/dmm/dmm_scripts/setup_hugepage.sh b/tests/dmm/dmm_scripts/setup_hugepage.sh
new file mode 100755
index 0000000000..be25709e01
--- /dev/null
+++ b/tests/dmm/dmm_scripts/setup_hugepage.sh
@@ -0,0 +1,37 @@
+#!/bin/bash -x
+
+# check and setup the hugepages
+SYS_HUGEPAGE=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages)
+hugepageFree=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/free_hugepages)
+
+if [ ${SYS_HUGEPAGE} -lt 1536 ] || [ $hugepageFree -eq 0 ]; then
+ MOUNT=$(mount | grep /mnt/nstackhuge)
+ count=$(mount | grep /mnt/nstackhuge | wc -l)
+
+ while [ "${MOUNT}" != "" ] || [ "${count}" -ne 0 ]
+ do
+ sudo umount /mnt/nstackhuge
+ sleep 1
+ MOUNT=$(mount | grep /mnt/nstackhuge)
+ count=$[$count -1]
+ done
+
+ sock_count=$(lscpu | grep 'Socket(s):' | head -1 | awk '{print $2}')
+ ls -l /sys/devices/system/node/
+
+ while [ "${sock_count}" -ne 0 ]
+ do
+ sock_count=$[$sock_count - 1]
+ echo 1536 | sudo tee /sys/devices/system/node/node"$sock_count"/hugepages/hugepages-2048kB/nr_hugepages
+ done
+
+ sudo mkdir -p /mnt/nstackhuge
+ sudo mount -t hugetlbfs -o pagesize=2M none /mnt/nstackhuge/
+ test $? -eq 0 || exit 1
+else
+ sudo mkdir -p /mnt/nstackhuge
+ sudo mount -t hugetlbfs -o pagesize=2M none /mnt/nstackhuge/
+fi
+
+cat /proc/meminfo
+exit 0