numam-spdk/scripts/configure_hugepages.sh
Daniel Verkamp c714a9f06f configure_hugepages: use number of pages on FreeBSD
Also request fewer huge pages overall during autotest.

Change-Id: I6744c9a948e8db24b8ed3c7d9d99c89e1e50ba9c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-12-07 16:32:19 -07:00

33 lines
524 B
Bash
Executable File

#!/usr/bin/env bash
set -e
function configure_linux {
if mount | grep -qv hugetlbfs; then
mkdir -p /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
fi
echo $NRHUGE > /proc/sys/vm/nr_hugepages
}
function configure_freebsd {
kldunload contigmem.ko || true
kenv hw.contigmem.num_buffers=$((NRHUGE * 2 / 32))
kenv hw.contigmem.buffer_size=$((32 * 1024 * 1024))
kldload contigmem.ko
}
if [ "$1" = "" ]; then
NRHUGE=1024
else
NRHUGE="$1"
fi
if [ `uname` = Linux ]; then
configure_linux
else
configure_freebsd
fi