test/setup: Perform custom alloc based on hugepages' size not quantity

512 and 1024 number of hugpages is not a sensible value in case 1G
hugepages are in use. Instead of setting fixed number of hugepages,
determine it safely based on the default size and allocate 1GB for
node0, 2GB for node1 (if present).

Fixes: #1954

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I850ba877332527a68ec4ddf7408fcc183835cda6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8012
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Michal Berger 2021-05-24 11:02:33 +02:00 committed by Tomasz Zawadzki
parent d07c581b7d
commit 3f674e1e29

View File

@ -134,28 +134,30 @@ odd_alloc() {
}
custom_alloc() {
# Custom alloc: node0 == 512 pages [node1 == 1024 pages]
# Custom alloc: node0 == 1GB [node1 == 2 GB]
local IFS=","
local node
local nodes_hp=()
local nr_hugepages=0
local nr_hugepages=0 _nr_hugepages=0
nodes_hp[0]=512
get_test_nr_hugepages $((1024 * 1024))
nodes_hp[0]=$nr_hugepages
if ((${#nodes_sys[@]} > 1)); then
nodes_hp[1]=1024
get_test_nr_hugepages $((2048 * 1024))
nodes_hp[1]=$nr_hugepages
fi
for node in "${!nodes_hp[@]}"; do
HUGENODE+=("nodes_hp[$node]=${nodes_hp[node]}")
((nr_hugepages += nodes_hp[node]))
((_nr_hugepages += nodes_hp[node]))
done
get_test_nr_hugepages_per_node
HUGENODE="${HUGENODE[*]}" setup
verify_nr_hugepages
nr_hugepages=$_nr_hugepages verify_nr_hugepages
}
hp_status() {