setup.sh: print hugepage distribution status in setup.sh status

Current output looks as follows:

$ ./scripts/setup.sh status
Hugepages
node     hugesize     free /    num
node0   1048576kB        7 /      9
node0      2048kB     6144 /   6144
node1   1048576kB        0 /      0
node1      2048kB        0 /  15360
NVMe devices
BDF             Numa Node       Driver name             Device name
0000:0a:00.0    0               nvme                    nvme0
[...]

Change-Id: I8cf019f2b4eaa966633427dd8c3759c979ba456c
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/402281
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2018-03-02 16:18:38 +01:00 committed by Jim Harris
parent d1f9da828a
commit 55241750a6

View File

@ -349,6 +349,35 @@ function reset_linux {
}
function status_linux {
echo "Hugepages"
printf "%-6s %10s %8s / %6s\n" "node" "hugesize" "free" "total"
numa_nodes=0
shopt -s nullglob
for path in /sys/devices/system/node/node?/hugepages/hugepages-*/; do
numa_nodes=$((numa_nodes + 1))
free_pages=`cat $path/free_hugepages`
all_pages=`cat $path/nr_hugepages`
[[ $path =~ (node[0-9]+)/hugepages/hugepages-([0-9]+kB) ]]
node=${BASH_REMATCH[1]}
huge_size=${BASH_REMATCH[2]}
printf "%-6s %10s %8s / %6s\n" $node $huge_size $free_pages $all_pages
done
shopt -u nullglob
# fall back to system-wide hugepages
if [ "$numa_nodes" = "0" ]; then
free_pages=`grep HugePages_Free /proc/meminfo | awk '{ print $2 }'`
all_pages=`grep HugePages_Total /proc/meminfo | awk '{ print $2 }'`
node="-"
huge_size="$HUGEPGSZ"
printf "%-6s %10s %8s / %6s\n" $node $huge_size $free_pages $all_pages
fi
echo "NVMe devices"
echo -e "BDF\t\tNuma Node\tDriver name\t\tDevice name"