setup.sh: do not unload/reload contigmem.ko on FreeBSD

When running "setup.sh config" (or setup.sh without
specify a mode - which defaults to config), do not
unload the contigmem driver and then reload it.  Over
time, memory can get fragmented and contigmem will fail,
crashing the system.

But still check if the requested HUGEMEM matches what was
previously specified.  If a different amount was requested,
unload contigmem as before and then reload with the new
amount.

This patch brings FreeBSD behavior in line with Linux.  On
Linux, we do not release all of the hugepages and then
reallocate them.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I18cb6fd4bdc1e1da0382423455ebce58c13bee7a

Reviewed-on: https://review.gerrithub.io/412238
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Jim Harris 2018-05-23 08:48:46 -07:00 committed by Daniel Verkamp
parent a34a1aa255
commit 8021da8ba6

View File

@ -466,10 +466,18 @@ function configure_freebsd_pci {
function configure_freebsd {
configure_freebsd_pci
kldunload contigmem.ko || true
# If contigmem is already loaded but the HUGEMEM specified doesn't match the
# previous value, unload contigmem so that we can reload with the new value.
if kldstat -q -m contigmem; then
if [ `kenv hw.contigmem.num_buffers` -ne "$((HUGEMEM / 256))" ]; then
kldunload contigmem.ko
fi
fi
if ! kldstat -q -m contigmem; then
kenv hw.contigmem.num_buffers=$((HUGEMEM / 256))
kenv hw.contigmem.buffer_size=$((256 * 1024 * 1024))
kldload contigmem.ko
fi
}
function reset_freebsd {