Commit 8021da8b authored by Jim Harris's avatar Jim Harris Committed by Daniel Verkamp
Browse files

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: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I18cb6fd4bdc1e1da0382423455ebce58c13bee7a

Reviewed-on: https://review.gerrithub.io/412238


Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
parent a34a1aa2
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -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 {