2015-09-21 21:48:40 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2015-09-25 16:12:57 +00:00
|
|
|
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 {
|
2015-10-03 00:11:56 +00:00
|
|
|
kldunload contigmem.ko || true
|
2015-12-07 22:51:25 +00:00
|
|
|
kenv hw.contigmem.num_buffers=$((NRHUGE * 2 / 32))
|
|
|
|
kenv hw.contigmem.buffer_size=$((32 * 1024 * 1024))
|
2015-10-03 00:11:56 +00:00
|
|
|
kldload contigmem.ko
|
2015-09-25 16:12:57 +00:00
|
|
|
}
|
|
|
|
|
2015-12-07 22:51:25 +00:00
|
|
|
if [ "$1" = "" ]; then
|
|
|
|
NRHUGE=1024
|
|
|
|
else
|
|
|
|
NRHUGE="$1"
|
|
|
|
fi
|
|
|
|
|
2015-09-25 16:12:57 +00:00
|
|
|
if [ `uname` = Linux ]; then
|
|
|
|
configure_linux
|
|
|
|
else
|
|
|
|
configure_freebsd
|
2015-09-21 21:48:40 +00:00
|
|
|
fi
|
|
|
|
|