Commit f062f797 authored by Hailiang Wang's avatar Hailiang Wang Committed by Daniel Verkamp
Browse files

scripts: replace NRHUGE with HUGEMEM in setup.sh



This allows to use same command
for allocating hugepages on
systems with different hugepage
sizes.

The old NRHUGE variable can be
still set on Linux machines,
but is currently undocumented.

Change-Id: I1fba315d95e9aae8b6a8c9c445deb447fecc65dc
Signed-off-by: default avatarHailiang Wang <hailiangx.e.wang@intel.com>
Signed-off-by: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/369546


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 07224340
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -46,12 +46,11 @@ Verify the configuration file has specified the correct NVMe SSD.
If there are any NVMe SSDs you do not wish to use for RocksDB/SPDK testing, remove them from the configuration file.

Make sure you have at least 5GB of memory allocated for huge pages.
By default, the SPDK `setup.sh` script only allocates 2GB (1024 huge pages).
The following will allocate 5GB worth of 2MB huge pages (in addition to binding the NVMe devices to uio/vfio).
If using 1GB huge pages, adjust the `NRHUGE` value accordingly.
By default, the SPDK `setup.sh` script only allocates 2GB.
The following will allocate 5GB of huge page memory (in addition to binding the NVMe devices to uio/vfio).

~~~{.sh}
NRHUGE=2560 scripts/setup.sh
HUGEMEM=5120 scripts/setup.sh
~~~

Create an empty SPDK blobfs for testing.
+6 −3
Original line number Diff line number Diff line
@@ -105,13 +105,16 @@ To rebind devices back to the kernel, you can run
sudo scripts/setup.sh reset
~~~

By default, the script allocates 1024 2MB hugepages. To change this number,
specify NRHUGE as follows:
By default, the script allocates 2048MB of hugepages. To change this number,
specify HUGEMEM (in MB) as follows:

~~~{.sh}
sudo NRHUGE=4096 scripts/setup.sh
sudo HUGEMEM=4096 scripts/setup.sh
~~~

On Linux machines HUGEMEM will be rounded up to system-default huge page
size boundary.

Example code is located in the examples directory. The examples are compiled
automatically as part of the build process. Simply call any of the examples
with no arguments to see the help output. If your system has its IOMMU
+2 −2
Original line number Diff line number Diff line
@@ -43,8 +43,8 @@ export SPDK_GPT_GUID=`grep SPDK_GPT_PART_TYPE_GUID $rootdir/lib/bdev/gpt/gpt.h \
			| awk -F "(" '{ print $2}' | sed 's/)//g' \
			| awk -F ", " '{ print $1 "-" $2 "-" $3 "-" $4 "-" $5}' | sed 's/0x//g'`

# Override the default NRHUGE in scripts/setup.sh
export NRHUGE=4096
# Override the default HUGEMEM in scripts/setup.sh
export HUGEMEM=8192

case `uname` in
	FreeBSD)
+6 −3
Original line number Diff line number Diff line
@@ -239,7 +239,7 @@ function configure_freebsd {
	rm $TMP

	kldunload contigmem.ko || true
	kenv hw.contigmem.num_buffers=$((NRHUGE * 2 / 256))
	kenv hw.contigmem.num_buffers=$((HUGEMEM / 256))
	kenv hw.contigmem.buffer_size=$((256 * 1024 * 1024))
	kldload contigmem.ko
}
@@ -249,8 +249,6 @@ function reset_freebsd {
	kldunload nic_uio.ko || true
}

: ${NRHUGE:=1024}

username=$1
mode=$2

@@ -270,7 +268,12 @@ if [ "$username" = "" ]; then
	fi
fi

: ${HUGEMEM:=2048}

if [ `uname` = Linux ]; then
	HUGEPGSZ=$(( `grep Hugepagesize /proc/meminfo | cut -d : -f 2 | tr -dc '0-9'` / 1024 ))
	: ${NRHUGE=$(( (HUGEMEM + HUGEPGSZ - 1) / HUGEPGSZ ))}

	if [ "$mode" == "config" ]; then
		configure_linux
	elif [ "$mode" == "reset" ]; then